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

add details_menu_migration linter #2148

Merged
merged 3 commits into from
Jul 21, 2023
Merged

Conversation

keithamus
Copy link
Member

@keithamus keithamus commented Jul 17, 2023

What are you trying to accomplish?

This adds a new linter to catch uses of <details-menu> which is likely from https://github.com/github/details-menu-element/. We'd like people to migrate because Primer::Alpha::ActionMenu offers better ergonomics and better support for assistive technologies, as well as more robust focus management.

Screenshots

N/A

Integration

Code in production will need to disable this rule, or disable each violation of this rule individually.

List the issues that this change affects.

Closes https://github.com/github/accessibility/issues/3730. Refs https://github.com/github/primer/issues/2417

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

This one.

Anything you want to highlight for special attention from reviewers?

Accessibility

  • No new axe scan violation - This change does not introduce any new axe scan violations.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented Jul 17, 2023

🦋 Changeset detected

Latest commit: a27a451

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

This PR includes changesets to release 1 package
Name Type
@primer/view-components 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

@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from 4a13ce4 to fda64c6 Compare July 17, 2023 16:21
@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from fda64c6 to 8856fec Compare July 17, 2023 16:23
@keithamus keithamus temporarily deployed to preview July 17, 2023 16:23 — with GitHub Actions Inactive
@keithamus keithamus temporarily deployed to github-pages July 17, 2023 16:28 — with GitHub Actions Inactive
@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from 8856fec to dae7495 Compare July 18, 2023 13:30
@keithamus keithamus temporarily deployed to preview July 18, 2023 13:30 — with GitHub Actions Inactive
@keithamus keithamus temporarily deployed to github-pages July 18, 2023 13:34 — with GitHub Actions Inactive
@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from dae7495 to 32b281c Compare July 18, 2023 14:20
@keithamus keithamus temporarily deployed to preview July 18, 2023 14:20 — with GitHub Actions Inactive
@keithamus keithamus temporarily deployed to github-pages July 18, 2023 14:25 — with GitHub Actions Inactive
@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from 32b281c to 76b8093 Compare July 20, 2023 13:15
@keithamus keithamus temporarily deployed to github-pages July 20, 2023 13:21 — with GitHub Actions Inactive
@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from 76b8093 to 89b97b4 Compare July 20, 2023 13:24
@keithamus keithamus temporarily deployed to preview July 20, 2023 13:24 — with GitHub Actions Inactive
@keithamus keithamus temporarily deployed to github-pages July 20, 2023 13:28 — with GitHub Actions Inactive
@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from 89b97b4 to db2736a Compare July 20, 2023 13:39
@keithamus keithamus temporarily deployed to preview July 20, 2023 13:39 — with GitHub Actions Inactive
@keithamus keithamus temporarily deployed to github-pages July 20, 2023 13:43 — with GitHub Actions Inactive
@keithamus keithamus marked this pull request as ready for review July 20, 2023 13:54
@keithamus keithamus requested review from a team and jonrohan July 20, 2023 13:54
This resolves an Uninitialized Constant error coming from ruby, because
`ERBLint::Linter::Primer::` is a namespace that exists. This error was
not invoked before because the only liner in that namespace -
`ERBLint::Linter::Primer::Accessibility::TooltippedMigration` in the
`tooltipped_migration.rb` file - would load _after_
`argument_mappers/label.rb` and `label_component_migration_counter.rb`.

The introduction of
`ERBLint::Linter::Primer::Accessibility::DetailsMenuMigration` in the
`details_menu_migration.rb` file would load _before_
`label_component_migration_counter.rb`, populating the
`ERBLint::Linter::Primer` namespace, which then causes the failed scope
lookup.

Prepending `::` to these values tells ruby to always look in the root
scope, not any local constants.
@keithamus keithamus force-pushed the add-details-menu-migration-linter branch from db2736a to a27a451 Compare July 20, 2023 14:56
Copy link
Contributor

@camertron camertron left a comment

Choose a reason for hiding this comment

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

🎉

@keithamus keithamus merged commit cbd5c84 into main Jul 21, 2023
29 checks passed
@keithamus keithamus deleted the add-details-menu-migration-linter branch July 21, 2023 17:16
@primer-css primer-css mentioned this pull request Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants