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

chore: add flipper spec #2862

Merged
merged 5 commits into from
Apr 6, 2020
Merged

chore: add flipper spec #2862

merged 5 commits into from
Apr 6, 2020

Conversation

chrisdholt
Copy link
Member

Description

This PR proposes adding a new spec for a flipper component.

Issue type checklist

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

Is this a breaking change?

  • This change causes current functionality to break.

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

- `fast-flipper`

*Attrs*
- `hiddenFromAT` - The control is hidden from assistive technology. Defaults to true
Copy link
Member Author

Choose a reason for hiding this comment

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

Feedback is welcome on a better name here :). Per previous comments by @EisenbergEffect, something like hiddenFromAssistiveTechnologies is a bit verbose. As an FYI, this convention was used here as an initial stub because the same language is often used by the W3C spec to denote when something is not exposed to AT users.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could maybe do something like:

@attr({attribute: "aria-hidden"})
public hiddenFromAT: boolean = true;

Then then user could simply write <fast-flipper aria-hidden="false" /> to override. Note that this doesn't seem to actually work - aria-hidden is overridden by the default property value but I think that might be a bug. You might also need to do write a custom converter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Overwriting built-ins may not be something we can support. I'm not sure. It would be nice to use aria-hidden if we can. Do we need to do anything in our own code in response to this changing?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it just needs to be hidden by default - perhaps when connected we could just check to see if the attribute exists, and if not set it imperatively.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's an interesting idea. What do you think @chrisdholt ?

Copy link
Member Author

Choose a reason for hiding this comment

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

So, if aria-hidden exists on the host, use that value and respond accordingly. If it doesn't exist, set aria-hidden in connectedCallback?

Copy link
Member Author

Choose a reason for hiding this comment

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

@nicholasrice @EisenbergEffect just want to confirm I'm understanding the proposed implementation (above)

Copy link
Member Author

Choose a reason for hiding this comment

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

Confirmed offline, I like this idea and think we should pursue it in implementation. 👍

specs/flipper/flipper.md Outdated Show resolved Hide resolved
@chrisdholt chrisdholt force-pushed the users/chhol/add-flipper-spec branch 2 times, most recently from 40667b6 to d6a1937 Compare April 1, 2020 23:38
Copy link
Contributor

@EisenbergEffect EisenbergEffect left a comment

Choose a reason for hiding this comment

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

I think we can move ahead with this. We may just need to do some experimentation around the aria-hidden scenario. Ideally, I think we want to just enable aria-hidden to work, but to provide a default value for that. The trick is that we don't want to overwrite the built-in, but we do want to get change callbacks. I'm not sure if the platform is going to let us do that. I can play with some things. If we can't make that work, we can always fallback to the original proposal of using hiddenFromAT .

Also, we could set up a MutationObserver on the host and observe attributes, but that seems a bit overkill if we can avoid it.

- `fast-flipper`

*Attrs*
- `hiddenFromAT` - The control is hidden from assistive technology. Defaults to true
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Overwriting built-ins may not be something we can support. I'm not sure. It would be nice to use aria-hidden if we can. Do we need to do anything in our own code in response to this changing?

```
<template
role="button"
aria-hidden=${x => x.hiddenFromAT}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just let the end user decide by adding aria-hidden themself or is there something we need to do internally in response to the hiddenFromAT property changing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Some of this depends on how we want to default it. If you default it to being exposed to assistive tech, then you need to drop the tabindex and add aria hidden in the event you want to hide it. If you default to hidden from assistive tech, the end user needs to add tabindex, override the internal aria-hidden behavior, and add the role of button. It's shown as persisting above, but I don't think we would add that if it were not exposed to AT. So, in a sense it's a swing of 3 properties on the implementors side to successfully transition between these states. I see a single prop to toggle this as a value add for empowering accessibility; however, we'd technically be empowering it as well by making someone handle it themselves.

@chrisdholt chrisdholt force-pushed the users/chhol/add-flipper-spec branch from 0b80d38 to 37ef089 Compare April 3, 2020 17:23
@chrisdholt chrisdholt merged commit 6d18b44 into master Apr 6, 2020
@chrisdholt chrisdholt deleted the users/chhol/add-flipper-spec branch April 6, 2020 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants