Skip to content

Ensure img/video/svg inside figure doesn't grow wider than the figure parent container - #5315

Open
patrickhlauke wants to merge 1 commit into
mainfrom
patrickhlauke-general-styles-figure-padding
Open

Ensure img/video/svg inside figure doesn't grow wider than the figure parent container#5315
patrickhlauke wants to merge 1 commit into
mainfrom
patrickhlauke-general-styles-figure-padding

Conversation

@patrickhlauke

@patrickhlauke patrickhlauke commented Aug 16, 2026

Copy link
Copy Markdown
Member

Currently, due to the additional 1px border, wide images/videos/svgs inside a figure can end up 2 pixels wider than the parent <figure> container. This is not normally a problem, but results in an unsightly "bump" in focus outline when navigating with a keyboard and jumping to a section that contains one of these wide figures.

Example: https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast#examples (make sure to navigate to it using the keyboard, to enable the focus outline)

example of a wide image - focus outline around the section has a "bump"

closeup showing the bump and the margin/padding for the figure - the image itself juts out by two pixels to the right

Forcing the box-sizing to take into account the border fixes this.

Preview: https://deploy-preview-5315--wcag2.netlify.app/understanding/non-text-contrast#examples

the same example of a wide image - focus outline around the section now doesn't have a bump

closeup showing that the image is now only as wide as the figure parent

@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploy Preview for wcag2 ready!

Name Link
🔨 Latest commit dc55e33
🔍 Latest deploy log https://app.netlify.com/projects/wcag2/deploys/6a81cc345f5dc70008f9eee4
😎 Deploy Preview https://deploy-preview-5315--wcag2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@patrickhlauke patrickhlauke moved this from To do to Drafted in WCAG 2.x Aug 16, 2026
@patrickhlauke patrickhlauke self-assigned this Aug 16, 2026
@patrickhlauke
patrickhlauke requested a review from adampage August 16, 2026 15:35

@adampage adampage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slam dunk. 🚀

@patrickhlauke patrickhlauke moved this from Drafted to Fully reviewed (Staging) in WCAG 2.x Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Fully reviewed (Staging)

Development

Successfully merging this pull request may close these issues.

2 participants