Skip to content

Commit

Permalink
fix invalid ARIA role attribute (#1249)
Browse files Browse the repository at this point in the history
* fix invalid ARIA role attribute

* change 'behaviourParams_item_clickAction' test to match the new role change
  • Loading branch information
Galpittel authored Jun 17, 2024
1 parent ebb0024 commit b160c66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/gallery/src/components/item/itemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ class ItemView extends React.Component {
data-hash={hash}
data-id={photoId}
data-idx={idx}
role={this.getItemAriaRole()}
{...(this.getItemAriaRole() && { role: this.getItemAriaRole() })}
data-hook="item-container"
key={'item-container-' + id}
style={this.getItemContainerStyles()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('options - behaviourParams_item_clickAction', () => {
expect(item.props().role).to.eq('button');
driver.detach.proGallery();
});
it('expect "role" to be "" when "behaviourParams_item_clickAction" is "nothing"', async () => {
it('expect no "role" attribute when "behaviourParams_item_clickAction" is "nothing"', async () => {
initialProps.options = Object.assign(initialProps.options, {
[optionsMap.behaviourParams.item.clickAction]:
GALLERY_CONSTS[optionsMap.behaviourParams.item.clickAction].NOTHING,
});
driver.mount.proGallery(initialProps);
await driver.update();
const item = driver.find.hook('item-container').at(3);
expect(item.props().role).to.eq('');
expect(item.props()).to.not.have.property('role');
driver.detach.proGallery();
});
});
Expand Down

0 comments on commit b160c66

Please sign in to comment.