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

[ampproject/amphtml] ♿ [Story a11y] Accessible close buttons #32925

Merged

Conversation

processprocess
Copy link
Contributor

Contributes to #32493
Applies same pattern used in share menu and Twitter overlay's close button.

  • Adds role=button back to close button elements (context).
  • Adds accessible close button for inline-attachment.
  • Fixes typo.

@amp-owners-bot
Copy link

Hey @gmajoulet, @newmuis, @Enriqe! These files were changed:

extensions/amp-story/1.0/amp-story-draggable-drawer-header.css
extensions/amp-story/1.0/amp-story-embedded-component.js
extensions/amp-story/1.0/amp-story-page-attachment.js
extensions/amp-story/1.0/amp-story-share-menu.js

@mszylkowski
Copy link
Contributor

Having a button with role="button" is what @gmajoulet was referring to in one of the comments? That would only make sense if there's sth parsing for the role attribute specifically

@gmajoulet
Copy link
Contributor

Having a button with role="button" is what @gmajoulet was referring to in one of the comments? That would only make sense if there's sth parsing for the role attribute specifically

Yes there is, it's very easy to break and we will change it asap, it tripped us many times in the past few weeks (for reference:

/**
* We want clicks on certain elements to be exempted from normal page
* navigation
* @param {!Event} event
* @param {!ClientRect} pageRect
* @return {boolean}
* @private
*/
isBottomCtaTappableTarget_(event, pageRect) {
const target = closest(
dev().assertElement(event.target),
(el) => {
const elementRole = el.getAttribute('role');
if (elementRole) {
return !!TAPPABLE_ARIA_ROLES[elementRole.toLowerCase()];
}
return false;
},
/* opt_stopAt */ this.element_
);
return !!target && this.isInScreenBottom_(target, pageRect);
}
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants