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

Add includeContainer option #15

Merged
merged 1 commit into from
Sep 21, 2017
Merged

Add includeContainer option #15

merged 1 commit into from
Sep 21, 2017

Conversation

vonagam
Copy link
Contributor

@vonagam vonagam commented Sep 17, 2017

Here is PR for #14.

Uses matches and some both support IE9.

Copy link
Collaborator

@davidtheclark davidtheclark left a comment

Choose a reason for hiding this comment

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

Nice, @vonagam!

Could you add some documentation and a test or two to finish the feature?

index.js Outdated
return matches.call(el, candidateSelector);
})
) {
candidates.unshift(el);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't we want to push this directly into orderedTabbables?

Copy link
Contributor Author

@vonagam vonagam Sep 17, 2017

Choose a reason for hiding this comment

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

Well, for my use case - no. I wanted to apply same rules to container. So if it has tabindex -1 or disabled or hidden it should not get in resulted list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And if it has tabindex = 0, then if we push it into orderedTabbables then it will appear after all basicTabbables but before any other orderedTabbables, which is incorrect result.

@@ -18,6 +20,18 @@ module.exports = function(el) {

var candidates = el.querySelectorAll(candidateSelectors);

if (options.includeContainer) {
var matches = Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting! I didn't know about this function.

@vonagam
Copy link
Contributor Author

vonagam commented Sep 21, 2017

Here, reused "nested" fixture for the test. Added note about options in Usage section.

@davidtheclark davidtheclark merged commit da8429e into focus-trap:master Sep 21, 2017
@davidtheclark
Copy link
Collaborator

Thanks again, @vonagam. Published in 1.1.0.

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.

2 participants