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

Access to Current/Previous Frame Element #111

Closed
ryanfitzer opened this issue Oct 9, 2018 · 7 comments
Closed

Access to Current/Previous Frame Element #111

ryanfitzer opened this issue Oct 9, 2018 · 7 comments

Comments

@ryanfitzer
Copy link

ryanfitzer commented Oct 9, 2018

I'm looking for some way to manipulate attributes for the current and previous frames.

For example, I'd like to toggle aria-hidden to be true/false depending on if the frame is showing or not.

I could do it in a widget using findDOMNode() and the index prop, but I'm hoping there is a better way. Passing these as refs to widgets is one idea. What do you think?

@amio
Copy link
Owner

amio commented Oct 9, 2018

I think this attribute aria-hidden should be built-in :D

@ryanfitzer
Copy link
Author

I agree that built-in would be nice, but there may be other use cases that require access.

@amio
Copy link
Owner

amio commented Oct 10, 2018

I prefer not to expose DOM element to the api surface in a React component, if there's some use case do need this, we may do it the DOM-way.

@ryanfitzer
Copy link
Author

The use case I’m looking to support is focusing the current frame after animation. This enables a screen reader to start reading immediately instead of the user having to move backward to find the element.

This could also be done in a different way by updating the properaria- attribute. Not the same, but helpful.

I understand your reluctance, The problem I see is maintaining a DOM reference during re-renders. Using a DOM method that returns a live NodeList would work, but not be as desirable as being passed the current frame as a ref.

The other issue is that since there are no hooks for [before/after]FrameAnimation There’s no way to know when to access the current frame. Widgets render() method are fired many times for each change of frame.

@amio
Copy link
Owner

amio commented Oct 10, 2018

[before/after]FrameAnimation hooks would be nice to have.

The use case I’m looking to support is focusing the current frame after animation. This enables a screen reader to start reading immediately instead of the user having to move backward to find the element.

I'll keep this in mind to see if I can make it easier while rewriting :D

@ryanfitzer
Copy link
Author

Thanks for being so open to my feedback :)

@amio amio closed this as completed in 3bbbaad Oct 24, 2018
@ryanfitzer
Copy link
Author

Thanks for the addition!

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

No branches or pull requests

2 participants