-
-
Notifications
You must be signed in to change notification settings - Fork 260
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 tab
helper (to simulate "tabbing" through focusable elements)
#1113
Conversation
1862730
to
250d6e4
Compare
does this respect the fact that on macOS Chrome only links are tab enabled by default, and links won't receive focus? |
@Turbo87 I am not sure what you mean? can you describe that behavior? and/or how it's different from other browsers? Today, I only tested the test suite in Firefox on linux. |
on macOS Chrome links are not part of the tab order. in other words: when you press Tab it won't focus links.
Firefox on macOS does focus links. Chrome on other platforms AFAIK also focusses links. |
OMG they finally fixed it 😂 forget everything I said... 🙈 |
@rwjblue I love this, can we have this please? ^_^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I can officially approve this but 100% I think it's great!
I'll try to review in detail this week. @NullVoxPopuli - Can you use the |
f38524a
to
ed28046
Compare
sure thing! did I do it right? I've never done a Co-authored by thing |
Thanks for picking this up NullVoxPopuli, and bringing it over the finish line. Re
This is the default behaviour in Safari on macOS, and there is a setting to change it.. I haven’t found a way of detecting this setting. The code doesn’t try to accommodate for Safari’s behaviour. Detecting Safari and filter out links |
ed28046
to
100d90e
Compare
Ok, I've fixed the attribution (thanks again, @mogstad !!!) Lemme know if anything needs to be done for this batch of work :) |
Co-Authored-By: Bjarne Mogstad <[email protected]>
100d90e
to
6d25288
Compare
if (workaroundForIE11) { | ||
let acceptNode = filter ? (filter.acceptNode as any as NodeFilter) : null; | ||
return ownerDocument.createTreeWalker( | ||
root, | ||
whatToShow, | ||
acceptNode, | ||
entityReferenceExpansion | ||
); | ||
} else { |
There was a problem hiding this 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 probably just say that we don't support new features in IE11 mode. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does that require a breaking release of test-helpers?
as long as I can still use this pre-ember 4, I think this sounds great :D
@@ -1,7 +1,7 @@ | |||
import isFormControl from './-is-form-control'; | |||
import { isDocument, isContentEditable, isWindow } from './-target'; | |||
|
|||
const FOCUSABLE_TAGS = ['A']; | |||
const FOCUSABLE_TAGS = ['A', 'SUMMARY']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to spec suggesting that this is focusable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, I should probably drop a bunch of spec links in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute you may have to ctrl+f to get to it, but this is the nearest anchor/header
function isVisible(element: Element): boolean { | ||
let styles = window.getComputedStyle(element); | ||
return styles.display !== 'none' && styles.visibility !== 'hidden'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this seems incomplete to me. 🤔
It could also be positioned outside the viewport, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah -- isVisible kinda has multiple meanings. 🤔
as implemented, it's like the real behavior where the tabbable element can be tabbed to even when it's not in the viewport (and normally this scrolls to the element so that it is in the viewport) -- maybe isVisible
should be renamed to isVisibleInDOM
and a separate isVisibleInViewport
should be implemented just to differentiate, even if unused initially?
// needs to be get so prop-paths can be used, such as "target.id" | ||
step += ` ${get(e, prop)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just look for the specfic ones we care about? I'd rather not use Ember.get
here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thoughts on lodash.get?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NullVoxPopuli what's the decision here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gonna leave ember.get, because of the need for nested property path accesses in the tests
Rename buildKeyboardEvent to _buildKeyboardEvent Rename SUPPORT_INHERT to SUPPORT_INERT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the concerns seem addressed and the tests are passing, I'm approving this PR so that we can move things forward. Thank you for working on this!
tab
helper (to simulate "tabbing" through focusable elements)
Looks like this missed adding |
It is not. It's #878 |
Continuation of: https://github.com/emberjs/ember-test-helpers/pull/771/files
Tested Locally: