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

feat(Sheet): add aria attributes #1555

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/Sheet/SheetContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,20 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS

return (
<React.Fragment>
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
<div
ref={this.veilRef}
className={sheetBlock('veil', veilTransitionMod)}
onClick={isAnimating ? undefined : this.onVeilClick}
onTransitionEnd={this.onVeilTransitionEnd}
role="presentation"
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to specify this. div has no semantics, and hasn't contain any children

Copy link
Contributor Author

@mournfulCoroner mournfulCoroner Apr 27, 2024

Choose a reason for hiding this comment

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

Thank you for information!
But I don't know how to avoid eslint-disable-next-line jsx-a11y/click-events-have-key-events because this div must be clickable. Maybe I could rewrite the component as a functional and use the useLayer instead of the usual handler? I also think it would be nice to add FocusTrap to the sheet content

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see, then let's keep it

/>
<div ref={this.sheetRef} className={sheetBlock('sheet', sheetTransitionMod)}>
<div
ref={this.sheetRef}
className={sheetBlock('sheet', sheetTransitionMod)}
role="dialog"
aria-modal="true"
aria-label={title}
>
{!hideTopBar && (
<div ref={this.sheetTopRef} className={sheetBlock('sheet-top')}>
<div className={sheetBlock('sheet-top-resizer')} />
Expand Down
Loading