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

bug:menu-button - fix duplicated menu-button id with multiple instances #970

Merged
merged 1 commit into from
Sep 28, 2022

Conversation

jeanpan
Copy link
Contributor

@jeanpan jeanpan commented Sep 14, 2022

This is to fix the issue when there is no id set specifically in menu-button, the id is menu-button--menu. It causes duplicated id if there are multiple menu-button instances on the page.

Before the fix

Screen Shot 2022-09-14 at 15 55 29

After the fix

Screen Shot 2022-09-14 at 16 21 37

Root cause
It's caused by the triggerId isn't updated since there is no dispatch action to update the state when the auto-id becomes valid.


  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code (Compile and run).
  • Add or edit tests to reflect the change (Run with yarn test).
  • Add or edit Storybook examples to reflect the change (Run with yarn start).
  • Ensure formatting is consistent with the project's Prettier configuration.
  • Add documentation to support any new features.

This pull request:

  • Creates a new package
  • Fixes a bug in an existing package
  • Adds additional features/functionality to an existing package
  • Updates documentation or example code
  • Other

If creating a new package:

  • Make sure the new package directory contains each of the following, and that their structure/formatting mirrors other related examples in the project:
    • examples directory
    • src directory with an index.tsx entry file
    • At least one example file per feature introduced by the new package
    • Base styles in a style.css file (if needed by the new package)

@@ -4,7 +4,8 @@

import * as React from "react";
import { Portal } from "@reach/portal";
import { useRect, PRect } from "@reach/rect";
import type { PRect } from "@reach/rect";
Copy link
Contributor Author

@jeanpan jeanpan Sep 14, 2022

Choose a reason for hiding this comment

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

These lines got updated by running pnpm lint --fix.

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 91640ca:

Sandbox Source
reach-ui-template Configuration

@jeanpan
Copy link
Contributor Author

jeanpan commented Sep 26, 2022

@chaance, would you mind to review this change? I'd like to have author to review the change to make sure I didn't miss anything. Thank you.

@chaance chaance merged commit 443516a into reach:dev Sep 28, 2022
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.

None yet

2 participants