Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button component without margin overhangs by 2px #5357

Open
andysellick opened this issue Sep 27, 2024 · 1 comment
Open

Button component without margin overhangs by 2px #5357

andysellick opened this issue Sep 27, 2024 · 1 comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) button

Comments

@andysellick
Copy link
Contributor

andysellick commented Sep 27, 2024

Description of the issue

The button component uses a 2px box shadow to provide a visual bottom border. This is used primarily instead of an actual bottom border because the other borders are already defined and this would cause a bevelling issue between the bottom and left/right borders. This means that the button component 'overhangs' by 2px at the bottom.

By default the button component has a margin bottom of 32px, which accounts for this 2px and then adds spacing in line with the spacing scale. However on GOV.UK we use the button component without bottom margin in our search filters, where it is supposed to line up with the bottom of a wrapping element. Due to this 2px of box shadow it doesn't, and we have to insert 2px of padding somewhere to account for this.

This is a very small thing, but if there were a way of preserving the look of the button while allowing it to not have this 2px of overhanging box shadow it would make integrating the button component into edge case scenarios like this a little easier.

Steps to reproduce the issue

Normal button appearance:

Normal button appearance with margin beneath

Button with zero margin applied to the bottom (note 2px overlap with containing element, highlighted):

Button inside a highlighted form element showing 2px overlap with container when margin removed

Use of button in GOV.UK search (mobile view) at bottom of containing element, note slight overlap/misalign with grey left border of container:

GOV.UK search page on mobile showing button overlapping bottom of containing element by 2px

Environment (where applicable)

  • Operating system: N/A
  • Browser: N/A
  • Browser version: N/A
  • GOV.UK Frontend Version: current (v5.6)
@andysellick andysellick added 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) awaiting triage Needs triaging by team labels Sep 27, 2024
Copy link

Uh oh! @andysellick, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@romaricpascal romaricpascal added button and removed awaiting triage Needs triaging by team labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) button
Projects
None yet
Development

No branches or pull requests

2 participants