-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Create the demo post content using the keyboard only #10682
Conversation
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.
Pretty cool. 🎉
Just a few comments; I know this isn't 100% finished yet. Ace, though.
//getEditedPostContent, | ||
} from '../support/utils'; | ||
|
||
async function uploadImageInTheMediaLibrary( assetFileName ) { |
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.
Might be a handy utility in general! 🤔
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.
True, but this one is very keyboard specific. I mean it could be considered generic but we need to include the whole block and not just assume the media library is open. I think it's fine to keep this one internal to this test for now.
await page.keyboard.up( META_KEY ); | ||
} | ||
|
||
jest.setTimeout( 1000000 ); |
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 assume this is for the upload, but worth adding a comment to explain 😄
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.
Actually, it's because this test take too long since it's a very long post :P (I think our current limit is 10 seconds)
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.
Hah! Right, that makes sense.
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.
Travis doesn't like it:
waiting for selector ".media-modal input[type=file]" failed: timeout 30000ms exceeded
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.
That's a different error @gziolo Intermittent, I saw it once locally but I don't know the real issue :(
await pressTimes( 'Tab', 4 ); // We should have a way to focus the block content | ||
await page.keyboard.press( 'Enter' ); | ||
await uploadImageInTheMediaLibrary( 'cover-1.jpg' ); | ||
await page.click( '.media-modal button.media-button-select' ); // validating the media gallery is not easy with keyboard |
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.
Not easy or impossible?
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.
Possible but you need to count "tabs" which is not great and break easily. There's probably a way to do it which is "tab + test if we reached the correct button"
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.
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.
If the tabbing breaks we should know about it, so I'd really prefer if we used a (fragile) keyboard solution 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.
Inserting media was a bit painful in my manual testing, I had to go through all the fields before I could insert.
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.
Would:
await page.click( '.media-modal button.media-button-select' ); // validating the media gallery is not easy with keyboard | |
await tabUntilElementIsActive( '.media-modal button.media-button-select' ); |
work here? If so it'd be great, but if not: okay. 🤷♂️ A follow-up issue to track it would be good though.
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.
It would work yet but I consider tabUntilElementIsActive
not an ideal solution. In general we should have some direct ways to access these buttons (like aria-regions in the medial library for instance).
But I'll update as it's slightly better.
// Create the aligned right paragraph | ||
await page.keyboard.press( 'Enter' ); | ||
await page.keyboard.type( '... like this one, which is right aligned.' ); | ||
await page.mouse.move( 200, 300, { steps: 10 } ); // This shouldn't be necessary to show the toolbar |
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.
🤔
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.
yes, mentioned in the description. We need to fix that.
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.
If you select the text you can get around it for now as it will show the toolbar.
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.
Even just command + A for now.
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.
My hot take: using (and thus highlighting) awkward interactions required by keyboard-only usage is better than using the mouse. 🤷♂️
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.
All the blocks don't have "text" so "command + A" won't always work. (Embed block for instance).
This is really cool, thanks. |
This is great 💯 |
Raised also in Slack (link requires registration): https://wordpress.slack.com/archives/C02QB2JS7/p1539202163000100 There, the focus of the discussion was on how to ensure the toolbar is visible so that Alt+F10, but your phrasing here sparked in my mind we should ensure the keybind does its intended operation regardless of the toolbar visibility. Related ideation in #10529. I'm interested in exploring this further. |
17f25ab
to
a9eac33
Compare
Youhou the test is passing on Travis 🎉 . The e2e tests take 1m30s longer but I think it's worth it. |
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.
This is a great start and we should merge it.
There are a few things we should file like where we skip keyboard nav because it's annoying or buggy? Either we should check if they're filed and link to the issues in the code/comments or file follow-up bugs to perfect this… but still this is such a great first, giant step. 🂡
getEditedPostContent, | ||
} from '../support/utils'; | ||
|
||
async function tabUntilElementIsActive( text ) { |
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.
COOOOOOOOL. We'll probably want to move that to the support utils eventually. 👍
await pressTimes( 'Tab', 4 ); // We should have a way to focus the block content | ||
await page.keyboard.press( 'Enter' ); | ||
await uploadImageInTheMediaLibrary( 'cover-1.jpg' ); | ||
await page.click( '.media-modal button.media-button-select' ); // validating the media gallery is not easy with keyboard |
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.
Would:
await page.click( '.media-modal button.media-button-select' ); // validating the media gallery is not easy with keyboard | |
await tabUntilElementIsActive( '.media-modal button.media-button-select' ); |
work here? If so it'd be great, but if not: okay. 🤷♂️ A follow-up issue to track it would be good though.
8c7fb4f
to
66ad03d
Compare
Failure noted in Slack: https://wordpress.slack.com/archives/C02QB2JS7/p1539801336000100
I'm seeing one as well locally, though different:
We might need to do more / generalized request stubbing (at least to third-party resources) as in #9924. |
await page.keyboard.type( 'https://vimeo.com/22439234' ); | ||
await page.keyboard.press( 'Enter' ); | ||
|
||
await moveMouse(); // This shouldn't be necessary to show the toolbar |
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.
See also #10699
This reverts commit 237d6ed.
This reverts commit 237d6ed.
Everything is on the title. I'm almost there:
Alt + F10
move to the toolbar only if it's visible, we should fix that.