Skip to content

fix(a11y): size external link icon based on browser/OS font-size - #12336

Open
SethFalco wants to merge 1 commit into
facebook:mainfrom
SethFalco:external-icon-size
Open

fix(a11y): size external link icon based on browser/OS font-size#12336
SethFalco wants to merge 1 commit into
facebook:mainfrom
SethFalco:external-icon-size

Conversation

@SethFalco

@SethFalco SethFalco commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

See commit message(s)!

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • N/A If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

I recently tested SVGO.dev with different font-sizes via the OS and browser settings to see how it'd behave.

Ideally anything that depends on the font-size should be sized relative to the font-size (em/rem), and anything that isn't can use any other unit (%/vw/px/etc.).

The external link icon on Docusaurus didn't behave as I expected. I believe this is an example of something that should be based on font-size. Do you see any issue with using rem instead of px?

The numbers I used are not the prettiest (as in the code, the UI looks fine), because I wanted the UI to look identical on the default font-size. But I can ofc round them if you'd prefer, though that would leave a subtle visual difference!

Screenshots

To demonstrate this, I'll include screenshots of your footer:

Before After
Extra Small localhost_3000_ localhost_3000_
Normal / Default localhost_3000_ (1) localhost_3000_ (1)
Extra Large localhost_3000_ (2) localhost_3000_ (2)

Normal / Default will look identical between before and after. Before the icon didn't scale with font-size, so in Extra Small it looks quite large, and on Extra Large it looked quite small. Now, it always looks proportionate to the text the icon is accompanying.

Test Plan

  • I added no unit tests.
  • Given the wide use of the icon, I thought it was fine to just refer to the footer.

Test links

Deploy preview: https://deploy-preview-12336--docusaurus-2.netlify.app/

Related issues/PRs

N/A

When the client is configured to use a different font-size than the default
(i.e. on the OS or in browser settings) the external link icon became
disproportionately sized relative to the text. This converts the hardcodes pixel
values to rem.
@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Aug 2, 2026
@netlify

netlify Bot commented Aug 2, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 15a28ba
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a6fa7ff1bed740008e46909
😎 Deploy Preview https://deploy-preview-12336--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant