这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@robdodson
Copy link
Collaborator

No description provided.

@robdodson robdodson requested a review from alice May 17, 2018 21:28
@robdodson
Copy link
Collaborator Author

@alice does this look ok to you?

async function tabUntil(body, end) {
let el;
while (true) {
focused = await driver.executeScript(`
Copy link
Member

Choose a reason for hiding this comment

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

Why a template literal here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All of the tests that manually execute script through webdriver use a template literal. https://github.com/WICG/focus-visible/blob/master/test/specs/programmatic-focus-always.js#L32-L34

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Blargh, GitHub submitted my reply before I was finished typing.

I originally used template literals because the code was copied from another project and we had done it there. I can update all of the tests if you'd prefer that.

el.nodeName !== 'HTML' &&
el.nodeName !== 'BODY'
el.nodeName !== 'BODY' &&
el.classList &&
Copy link
Member

Choose a reason for hiding this comment

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

can we do 'classList' in el && 'contains' in el.classList to avoid breaking my brain?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure

break;
}
if (focused) {
// IE11's selenium driver won't move focus if we send it to body again
Copy link
Member

Choose a reason for hiding this comment

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

This whole block looks like the result of a lot of crying and furious Googling.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was mostly just swearing and trying stuff. Googling was no help.

await body.click();
await tabUntil(body, 'end');
let actual = await driver.executeScript(`
return window.getComputedStyle(document.querySelector('#end')).outlineColor
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment explaining how this tests for the failure mode you describe at the top of the file?

@robdodson
Copy link
Collaborator Author

made some changes...let's see if sauce still passes 🤞

@robdodson
Copy link
Collaborator Author

womp womp

@jasononeil
Copy link

Thanks for this! We were getting a flood of Unable to get property 'contains' of undefined or null reference errors in IE11 and this was the root cause. While we wait for this to be merged we've used focusable=false on our inline SVG tags.

Is there anything I can help with to get this merged? It looks like the tests timed out on Edge

@robdodson
Copy link
Collaborator Author

oh I totally forgot this had not landed yet! I think the only thing holding it back is my poorly written test. I may break this PR in half because I'm confident the fix works, but getting the test to run reliable in SauceLabs is weird. Let me try that, we can land the fix at least, and I'll do a separate PR for the test.

@robdodson
Copy link
Collaborator Author

oh sweet, it looks like the tests actually do pass. The previous failure was just Sauce Labs timing out. I misread the output :P

Merging!

@robdodson robdodson merged commit 1756d66 into master Aug 4, 2018
@jasononeil
Copy link

Great, thanks so much!

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.

4 participants