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

Fix title and subtitle tag for Dialog2 and ConfirmationDialog #1754

Merged
merged 2 commits into from
Dec 21, 2021

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented Dec 20, 2021

Fixes #1753

title should use h1 and subtitle should use h2 instead of div

Merge checklist

  • NA Added/updated tests
  • NA Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@siddharthkp siddharthkp requested review from a team and rezrah December 20, 2021 16:57
@changeset-bot
Copy link

changeset-bot bot commented Dec 20, 2021

🦋 Changeset detected

Latest commit: 680361f

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 Patch

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

@siddharthkp siddharthkp changed the title use h1 + h2 for Dialogs Fix title and subtitle tag for Dialog2 and ConfirmationDialog Dec 20, 2021
@siddharthkp siddharthkp self-assigned this Dec 20, 2021
@siddharthkp siddharthkp added accessibility patch release bug fixes, docs, housekeeping react labels Dec 20, 2021
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
dist/browser.esm.js 58.94 KB (+0.04% 🔺)
dist/browser.umd.js 59.27 KB (+0.05% 🔺)

@pksjce
Copy link
Collaborator

pksjce commented Dec 20, 2021

LGTM. Why the margin overrides though?

${sx};
`

const Subtitle = styled.div<SxProp>`
const Subtitle = styled.h2<SxProp>`
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if this makes semantic sense. Should it be a p instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Following it from #1753, should be h2

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I've been thinking about this and it's a good question. I naturally leaned towards <h2> but I'm not sure that's actually the right thing. Maybe @bolonio will have opinions here?

Sorry if that turns out to be the wrong tag for the description!

Copy link

Choose a reason for hiding this comment

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

First of all, we can agree that Dialog title headings should be <h1>. I would go with <h2> for the subtitle as well, since modal dialogs are considered areas that are distinct from their parent document, so they have their own heading level structure. I wouldn't say that using a <p> is wrong, since not having a <h2> heading is possible. I've been reading about it and I couldn't find anything about subtitle or <h2> in dialog (of course there are some information about the dialog title to be <h1>).

Related issues:

@siddharthkp
Copy link
Member Author

Why the margin overrides though?

h1 and h2 have default margins in the browser's stylesheet, so we we override it with the margin we want.

Copy link
Contributor

@rezrah rezrah left a comment

Choose a reason for hiding this comment

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

Nice one @siddharthkp ⚡. Would be nice to have some test coverage on the heading roles, but we can follow-up on that later.

@siddharthkp siddharthkp merged commit 08cdb0b into main Dec 21, 2021
@siddharthkp siddharthkp deleted the siddharth/fix-dialog-heading-tag branch December 21, 2021 09:48
@primer-css primer-css mentioned this pull request Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility patch release bug fixes, docs, housekeeping react
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dialog2 should use h1 and h2 for title and description
5 participants