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

[Select] Fix custom options menu not opening on Avatar click #34648

Merged
merged 6 commits into from Nov 7, 2022

Conversation

shivam1646
Copy link
Contributor

@shivam1646 shivam1646 commented Oct 6, 2022

@mui-bot
Copy link

mui-bot commented Oct 6, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-34648--material-ui.netlify.app/

Details of bundle changes

Generated by 🚫 dangerJS against a510134

@siriwatknp
Copy link
Member

siriwatknp commented Oct 7, 2022

Thanks for the PR, really appreciate your time. Can you take a look at my comment and then we can continue this PR once we have the decision?

@shivam1646
Copy link
Contributor Author

Hi @siriwatknp just checking in. Any updates on the PR?

@siriwatknp
Copy link
Member

siriwatknp commented Nov 2, 2022

@shivam1646 The logic looks good to me. Let's add documentation about stopPropagation() if an interactive element is added as a decorator.

https://mui.com/joy-ui/react-select/#decorators

@shivam1646
Copy link
Contributor Author

@siriwatknp does this look fine?
Screenshot 2022-11-02 at 7 53 33 PM

@siriwatknp
Copy link
Member

@siriwatknp does this look fine?

May be:

"If you have interactive elements as the select's decorators, call stopPropagation() from the mouse down event to prevent the popup from being open"

<Select
  endDecorator={
    <IconButton
      onMouseDown={event => {
        // the event will not propagate to the select's button.
        event.stopPropagation();
      }}
      onClick={() => {
        // click handler goes here.
      }}
    >...</IconButton>
  }
>

@shivam1646
Copy link
Contributor Author

@siriwatknp I have updated PR with the documentation.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍 Thanks for your contribution!

@siriwatknp siriwatknp changed the title [Joy Select]: Fix custom options menu not opening on Avatar click [Select] Fix custom options menu not opening on Avatar click Nov 3, 2022
@siriwatknp siriwatknp added the component: select This is the name of the generic UI component, not the React module! label Nov 3, 2022
@@ -52,6 +52,20 @@ Use the `startDecorator` and/or `endDecorator` props to add supporting icons or

{{"demo": "SelectDecorators.js"}}

If you have interactive elements as the select's decorators, call `stopPropagation()` from the mouse down event to prevent the popup from being opened.
Copy link
Member

Choose a reason for hiding this comment

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

I guess that developers will need to be careful with the a11y aspect of this. For instance, it might have helped to remove the icon button from the tab sequence in the code snippet. I mean in https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-autocomplete-list.html they seem to encourage that only the root of the select should be focusable (and tabbable).

Removes the button from the tab sequence of the page because its function is redundant with the keyboard operation of the combobox.

the-mgi pushed a commit to the-mgi/material-ui that referenced this pull request Nov 17, 2022
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
feliperli pushed a commit to jesrodri/material-ui that referenced this pull request Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joy Select : Menu is not opening if you click on the Avatar.
5 participants