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(PageLayout): restore main landmark #3737

Merged
merged 2 commits into from
Sep 13, 2023
Merged

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Sep 12, 2023

Follow-up to: #3675

Currently, we have teams in a couple of situations where either:

  • A team makes use of a main landmark and therefore runs into the duplicate landmark violation
  • A team uses the default main landmark from PageLayout.Content

When removing the main landmark, teams in the latter group are impacted. In this PR, we introduce an as prop to allow for teams in the first example to change the semantics of this component to as="div" as they already have a main defined.

Rollout

This is an incremental rollout strategy if our ideal here is to remove main as a landmark from PageLayout.Content. With this path, we could swap teams to use as="div" before removing the main support and also dropping as="div"

@joshblack joshblack requested review from a team and josepmartins September 12, 2023 18:57
@changeset-bot
Copy link

changeset-bot bot commented Sep 12, 2023

🦋 Changeset detected

Latest commit: 245b067

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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 100.7 KB (+0.01% 🔺)
dist/browser.umd.js 101.29 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.

Oof tough spot! But really good rollout plan!

@siddharthkp
Copy link
Member

siddharthkp commented Sep 13, 2023

With this path, we could swap teams to use as="div" before removing the main support and also dropping as="div"

(not for this PR, but for after) How do you feel about this slight change:

Right now, the default element is main. If we want to change the default to div, folks that do not have duplicate main, would then need to wrap PageLayout.Content in a <main>

How do you feel about supporting the as prop on PageLayout.Content permanently, but with just 2 options: as: 'main' | 'div'.

So, changing the default from main to div would still be a breaking change, but it can be accompanied by a codemod that adds as="main" for instances that do not have as="div" already.

@siddharthkp siddharthkp added this pull request to the merge queue Sep 13, 2023
Merged via the queue into main with commit a93eca2 Sep 13, 2023
29 of 30 checks passed
@siddharthkp siddharthkp deleted the fix/update-main-landmark branch September 13, 2023 12:34
@primer primer bot mentioned this pull request Sep 13, 2023
@joshblack
Copy link
Member Author

@siddharthkp I like it, works for me!

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.

2 participants