Skip to content

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

Merged
oliviertassinari merged 1 commit intomui:masterfrom
oliviertassinari:fix-aria-label
Jan 2, 2024
Merged

[docs-infra] Fix missing button aria-label#40394
oliviertassinari merged 1 commit intomui:masterfrom
oliviertassinari:fix-aria-label

Conversation

@oliviertassinari
Copy link
Copy Markdown
Member

@oliviertassinari oliviertassinari added type: bug It doesn't behave as expected. accessibility a11y scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). labels Jan 1, 2024
@mui-bot
Copy link
Copy Markdown

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

<IconButton
onClick={() => setIsExtended((prev) => !prev)}
className="MuiApi-expend-button"
aria-label={isExtended ? 'Collapse' : 'Expand'}
Copy link
Copy Markdown
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
Copy Markdown
Member Author

@oliviertassinari oliviertassinari Jan 1, 2024

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
Copy Markdown
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
Copy Markdown
Member Author

@oliviertassinari oliviertassinari Jan 2, 2024

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
Copy Markdown
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
@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 scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants