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

[docs-infra] Fix missing button aria-label #40394

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work accessibility a11y scope: docs-infra Specific to the docs-infra product labels Jan 1, 2024
@mui-bot
Copy link

mui-bot commented Jan 1, 2024

Netlify deploy preview

https://deploy-preview-40394--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 4f42e4b

@@ -228,6 +227,7 @@ function ApiItem(props: ApiItemProps) {
<IconButton
onClick={() => setIsExtended((prev) => !prev)}
className="MuiApi-expend-button"
aria-label={isExtended ? 'Collapse' : 'Expand'}
Copy link
Member Author

Choose a reason for hiding this comment

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

The fix.

The rest is to sync the code with the baseline convention.

Comment on lines -45 to +46
export const getHash = ({ componentName, className }: HashParams) =>
`${componentName ? `${componentName}-` : ''}classes-${className}`;
export function getHash({ componentName, className }: HashParams) {
return `${componentName ? `${componentName}-` : ''}classes-${className}`;
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure about this logic.

It feels weird when reading https://mui.com/material-ui/api/dialog/#Dialog-classes-paper.
I think https://mui.com/material-ui/api/dialog/#.MuiDialog-paper would be for the best DX.

Copy link
Member

Choose a reason for hiding this comment

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

I wrote it with the goal of having unique id in mind. So I went with the strategy:

id = [componentName]-[listType]-[lineName]

The extreme case is the base API pages where multiple components are documented in a single web page. Here for example are two instance of .Mui-expanded in the same page:

https://mui.com/base-ui/react-menu/components-api/#MenuButton-classes-expanded
https://mui.com/base-ui/react-menu/components-api/#Menu-classes-expanded

Make me realise the navigation is broken for css classes

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah right, I forgot about these global class names 🤦‍♂️, they are not unique.

Make me realise the navigation is broken for css classes

I saw the same thing, fixed in #40395

@oliviertassinari oliviertassinari changed the title [docs-infra] Fix 301 links to Toolpad [docs-infra] Fix missing button aria-label Jan 1, 2024
Comment on lines -45 to +46
export const getHash = ({ componentName, className }: HashParams) =>
`${componentName ? `${componentName}-` : ''}classes-${className}`;
export function getHash({ componentName, className }: HashParams) {
return `${componentName ? `${componentName}-` : ''}classes-${className}`;
Copy link
Member

Choose a reason for hiding this comment

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

I wrote it with the goal of having unique id in mind. So I went with the strategy:

id = [componentName]-[listType]-[lineName]

The extreme case is the base API pages where multiple components are documented in a single web page. Here for example are two instance of .Mui-expanded in the same page:

https://mui.com/base-ui/react-menu/components-api/#MenuButton-classes-expanded
https://mui.com/base-ui/react-menu/components-api/#Menu-classes-expanded

Make me realise the navigation is broken for css classes

@oliviertassinari oliviertassinari merged commit 571b15a into mui:master Jan 2, 2024
19 checks passed
@oliviertassinari oliviertassinari deleted the fix-aria-label branch January 2, 2024 15:44
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y bug 🐛 Something doesn't work scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants