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

refactor(VisuallyHidden): update base element from div to span #4691

Merged
merged 4 commits into from
Jun 27, 2024

Conversation

joshblack
Copy link
Member

Update our internal utility VisuallyHidden to use a <span> by default over a <div>. This is due to the fact that a <div> is not allowable in all contexts, for example a <div> cannot be rendered within a <p>. As a result, this helper may not work as intended if a component is within a specific context. Moving over to a span by default will help with this as it it allowed in all contexts (hopefully).

Changelog

New

Changed

  • Change base element from div to span for VisuallyHidden
  • Update Spinner to no longer have to specify span in as

Removed

Rollout strategy

  • Minor release

@joshblack joshblack requested a review from a team as a code owner June 20, 2024 19:49
Copy link

changeset-bot bot commented Jun 20, 2024

🦋 Changeset detected

Latest commit: eaa9b66

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jun 20, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 90.8 KB (-0.03% 🔽)
packages/react/dist/browser.umd.js 91.09 KB (+0.01% 🔺)

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

LGTM!

Do you suspect any layout related changes for siblings when moving from a block element to span element?

@joshblack
Copy link
Member Author

@siddharthkp I'm not sure honestly 🤷 curious what you all think. Since this is hidden and position: absolute I would assume that it's not participating in layouts but I am very aware of the fact that I could be missing a scenario where that is true 😅

@joshblack joshblack added this pull request to the merge queue Jun 27, 2024
Merged via the queue into main with commit 55e97a9 Jun 27, 2024
30 checks passed
@joshblack joshblack deleted the refactor/visually-hidden-as-span branch June 27, 2024 18:41
@primer primer bot mentioned this pull request Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants