Skip to content

Conversation

@scottgonzalez
Copy link
Member

Ref #14596
Ref gh-1583

@jzaefferer
Copy link
Member

Tests?

@jzaefferer
Copy link
Member

Nevermind, saw your comment about IE8. Looks good to me.

@scottgonzalez
Copy link
Member Author

I can add a test that explicitly assigned visibility: inherit which would cause all browsers to hit this code path.

@jzaefferer
Copy link
Member

That seems useful.

ui/focusable.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also check for element.length !== 0 to avoid a possible infinite loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no possible infinite loop here. If the element doesn't exist, it can't have a visibility of "inherit".

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course. 👍

@scottgonzalez
Copy link
Member Author

Tests added. It turns out that even with these tests, only IE 8 will hit the new code path. All other browsers resolve inherit to either hidden or visible when getting the computed value (which makes sense). As such, I've marked the visible() method as supporting IE 8, but not the tests. The test cases are still valid, and if the implementation were to ever change to checking element.style instead of the computed style, the tests would catch the failure (unless the tree walking logic still existed).

@jzaefferer
Copy link
Member

Looks good. Somewhat related: medialize/ally.js#41

@scottgonzalez scottgonzalez deleted the focusable-visibility-inherit branch February 9, 2016 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants