Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-collapsible-menu-view] Removes dialog role for menu and sets aria-haspopup #2127

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions packages/terra-collapsible-menu-view/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Fixed
* Set aria-haspopup value to boolean.

## 6.97.0 - (April 4, 2024)

* Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class CollapsibleMenuViewItem extends React.Component {
button={(
<Button
{...attributes}
aria-haspopup="dialog"
aria-haspopup
icon={icon}
text={text}
isReversed={isReversed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('CollapsibleMenuViewItem', () => {
<CollapsibleMenuViewItem text="Default Item 2" key="defaultItem2" />,
]}
/>);
expect(wrapper.find('Button').prop('aria-haspopup')).toEqual('dialog');
expect(wrapper.find('Button').prop('aria-haspopup')).toBe(true);
});

it('should render a disabled button when isDisabled is set', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ exports[`CollapsibleMenuViewItem should render a menu when subMenuItems are give
<CollapsibleMenu
button={
<Button
aria-haspopup="dialog"
aria-haspopup={true}
intl={
Object {
"defaultFormats": Object {},
Expand Down
3 changes: 3 additions & 0 deletions packages/terra-menu/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Removed dialog role to fix axe a11y violation.

## 6.91.0 - (April 4, 2024)

* Changed
Expand Down
1 change: 1 addition & 0 deletions packages/terra-menu/src/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class Menu extends React.Component {
hookshotPostionFixed
isHeaderDisabled
isContentFocusDisabled
popupContentRole={null}
sugan2416 marked this conversation as resolved.
Show resolved Hide resolved
>
{slides}
</Popup>
Expand Down
3 changes: 1 addition & 2 deletions packages/terra-menu/src/_MenuContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,12 @@ class MenuContent extends React.Component {
const contentWidth = this.props.isWidthBounded ? undefined : this.props.fixedWidth;
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, react/forbid-dom-props */
return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
ref={this.handleContainerRef}
className={contentClass}
style={{ height: menuHeight, width: contentWidth, position: contentPosition }}
tabIndex="-1"
aria-modal="true"
role="dialog"
onKeyDown={this.onKeyDown}
// stop event propagation in case Menu oppened inside the layout component that has its own event handler for that event.
// added for Menu Button support in terra-compact-interactive-list.
Expand Down
15 changes: 5 additions & 10 deletions packages/terra-menu/tests/jest/__snapshots__/Menu.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`Menu correctly applies the theme context className 1`] = `
isHeaderDisabled={true}
isOpen={true}
onRequestClose={[MockFunction]}
popupContentRole="dialog"
popupContentRole={null}
targetRef={
[MockFunction] {
"calls": Array [
Expand Down Expand Up @@ -203,17 +203,14 @@ exports[`Menu correctly applies the theme context className 1`] = `
<div
class="content content orion-fusion-theme fixed-position"
data-terra-popup-content="true"
role="dialog"
>
<div
class="inner"
data-terra-popup-automatic-height="true"
style="width: 240px;"
>
<div
aria-modal="true"
class="content orion-fusion-theme"
role="dialog"
style="position: static;"
tabindex="-1"
>
Expand Down Expand Up @@ -295,7 +292,7 @@ exports[`Menu correctly applies the theme context className 1`] = `
onContentResize={[Function]}
onRequestClose={[Function]}
onResize={[Function]}
popupContentRole="dialog"
popupContentRole={null}
refCallback={[Function]}
>
<FocusTrap
Expand Down Expand Up @@ -328,7 +325,7 @@ exports[`Menu correctly applies the theme context className 1`] = `
outsideClickIgnoreClass="ignore-react-onclickoutside"
preventDefault={false}
refCallback={[Function]}
role="dialog"
role={null}
stopPropagation={false}
tabIndex={null}
>
Expand All @@ -350,14 +347,14 @@ exports[`Menu correctly applies the theme context className 1`] = `
outsideClickIgnoreClass="ignore-react-onclickoutside"
preventDefault={false}
refCallback={[Function]}
role="dialog"
role={null}
stopPropagation={false}
tabIndex={null}
>
<div
className="content content orion-fusion-theme fixed-position"
data-terra-popup-content={true}
role="dialog"
role={null}
tabIndex={null}
>
<div
Expand Down Expand Up @@ -426,11 +423,9 @@ exports[`Menu correctly applies the theme context className 1`] = `
title=""
>
<div
aria-modal="true"
className="content orion-fusion-theme"
onFocus={[Function]}
onKeyDown={[Function]}
role="dialog"
style={
Object {
"height": undefined,
Expand Down
Loading