-
Notifications
You must be signed in to change notification settings - Fork 128
A11y accessible modals #290
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
A11y accessible modals #290
Conversation
Co-Authored-By: Carlos Pereira Atencio <carlos@microbit.org>
Co-Authored-By: Carlos Pereira Atencio <carlos@microbit.org>
Co-Authored-By: Carlos Pereira Atencio <carlos@microbit.org>
Co-Authored-By: Carlos Pereira Atencio <carlos@microbit.org>
…ythonEditor into a11y-modal-focus-update
Fixed the issue with the table cells being selectable in this PR: microbit-mark#1 |
We can use blur on that element. Have done so inline 02b67c6, but not sure if that's the best approach. |
Might be better to just remove the focus CSS? |
Have moved this to css and fixed the conflict |
To avoid having something always focused when using the mouse, could we do this?
Alternatively, if we focus the element that we just edited to remove the focus CSS (01eb6dc) that would still have an element inside the modal focused and let users tab through the modal. |
I can't recreate in Safari 13.0.2. But Safari 12 exhibits the issue.
I think good practice would be to pass the focus to the modal and trap it and show element focus if the user has entered the modal via keyboard. If they have used the mouse, don't show focus. I have added a commit that focusses the div rather than the first selectable element |
@microbit-carlos syntax error I think 8367008 only Safari prior to 13 complained about it. :) I've tried this in browserstack, can you test locally when you have a moment @microbit-carlos |
It works! Looks like i accidentally deleted one bracket more than necessary, thanks Mark! |
Seem to have introduced another issue somewhere with the files help, now i've made it a button element |
@microbit-mark is this PR ready or are there still things to iron out? |
Ready :) |
editor.html
Outdated
</div> | ||
<div id="addFile"> | ||
<div id="addFileHeader"> | ||
<h2 class="modal-title"><i class="fa fa-download"></i> <strong>{{ files-title }}</strong></h2> | ||
</div> | ||
<div id="addFileHelp"><a class="action" id="files-expand-help"><i class="fa fa-info-circle" aria-hidden="true"> <span>{{ help-button }}</span></i></a></div> | ||
<div id="addFileHelp"> | ||
<button aria-labelledby="add-files" aria-expanded="false" type="button" class="snippet-button" id="expandHelpPara"><i class="fa fa-info-circle"><span>{{ help-button }}</span></i></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.
I think font awesome expects no content inside the <i ...></i>
element. Should the text be moved after the closing </i>
?
Also, it looks like <span>
is not required?
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.
Should this not be updated as well?
static/css/style.css
Outdated
outline: inherit; | ||
} | ||
.snippet-button:focus { | ||
box-shadow: 0px 0px 5px 3px #FFCC33; |
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.
We will need a PR in python-editor for the foundation colours, could you prepare that as well?
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've pushed the branch up https://github.com/microbit-foundation/python-editor/tree/a11y-modal-focus, not sure specifically what changes to make
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 FFCC33
is the upstream yellow we will need a new branch from python-editor overwriting in style-foundation.css the new classes setting this colour to the foundation yellow.
This needs to be a new branch from the python-editor master, as it's in a different file not present here.
.save-button.py:focus { | ||
box-shadow: 0px 0px 5px 3px #FFCC33; | ||
} | ||
|
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.
The number of spaces for the CSS in this file is a bit of a mess, but I think right now there is more classes using 4 spaces than 2. Could we update all new classes use to use 4 spaces as well?
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've added further spacing to the css to tidy up
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.
Sorry, I meant the 4 spaces like this:
.save-button.py:focus {
box-shadow: 0px 0px 5px 3px #FFCC33;
}
To:
.save-button.py:focus {
box-shadow: 0px 0px 5px 3px #FFCC33;
}
This is shaping up fantastically, great work Mark!
The testing should include opening the modals, iterating through the elements, activating a few of them with the keyboard, click on a couple of elements to ensure the click handlers are still working, and test at least one of the snippets with the keyboard and the mouse. |
Tests
✔️ Safari 13 Mac Mojave @microbit-carlos This works in all browsers, but for mac, full keyboard accessibility needs to be enabled and tabbing in safari |
static/css/style.css
Outdated
outline: inherit; | ||
} | ||
.snippet-button:focus { | ||
box-shadow: 0px 0px 5px 3px #FFCC33; |
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 FFCC33
is the upstream yellow we will need a new branch from python-editor overwriting in style-foundation.css the new classes setting this colour to the foundation yellow.
This needs to be a new branch from the python-editor master, as it's in a different file not present here.
.save-button.py:focus { | ||
box-shadow: 0px 0px 5px 3px #FFCC33; | ||
} | ||
|
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.
Sorry, I meant the 4 spaces like this:
.save-button.py:focus {
box-shadow: 0px 0px 5px 3px #FFCC33;
}
To:
.save-button.py:focus {
box-shadow: 0px 0px 5px 3px #FFCC33;
}
editor.html
Outdated
</div> | ||
<div id="addFile"> | ||
<div id="addFileHeader"> | ||
<h2 class="modal-title"><i class="fa fa-download"></i> <strong>{{ files-title }}</strong></h2> | ||
</div> | ||
<div id="addFileHelp"><a class="action" id="files-expand-help"><i class="fa fa-info-circle" aria-hidden="true"> <span>{{ help-button }}</span></i></a></div> | ||
<div id="addFileHelp"> | ||
<button aria-labelledby="add-files" aria-expanded="false" type="button" class="snippet-button" id="expandHelpPara"><i class="fa fa-info-circle"><span>{{ help-button }}</span></i></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.
Should this not be updated as well?
a42c441
to
7d9f5b2
Compare
Co-Authored-By: Carlos Pereira Atencio <carlos@microbit.org>
Co-Authored-By: Carlos Pereira Atencio <carlos@microbit.org>
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.
Great work here Mark!
All good and ready for merge
Have also added https://github.com/microbit-foundation/python-editor/pull/107 as per #290 (comment) |
fixes https://github.com/microbit-foundation/platform-software-issue-tracker/issues/407
and fixes https://github.com/microbit-foundation/platform-software-issue-tracker/issues/519
does not include error modals