[Accessibility] Search sources widget needs to be accessible.
Here is a list of accessibility improvements for the search sources interface (note: autocomplete accessibility should be worked on in #4071 ):
Search Input
- [x] Magnifying glass icon should have an ARIA role of "presentation" as it doesn't carry any meaningful semantics.
- [x] input element should have a type of "search".
- [x] input element should have keyboard focus styling.
- [ ] Results number section "X results" should have an ID set. This way we can apply an ARIA attribute aria-describedby on the input field.
- [x] Close button should be an actual button or at least have a role "button". It should have styling for focused-with-keyboard case. It should also be focusable and actionable with the keyboard.
Bottom Bar
- [ ] "Search sources..." and "Find in files…" are not accessible. Semantically they should be radio buttons that are mutually exclusive. User should also be able to navigate to them using the keyboard only (tabbing to). They should also be actionable when Enter/Space are pressed.
- [ ] When "Search sources..." is selected and keyboard focus is inside the input there is a keyboard trap. There is no way to tab out of the input field (neither forward nor back).
Screenshot

Magnifying glass icon should have an ARIA role of "presentation" as it doesn't carry any meaningful semantics.
This is an example of how to add an appropriate role to an element. In this case role "presentation" (https://www.w3.org/TR/wai-aria/roles#presentation) to an icon.
diff --git a/assets/images/Svg.js b/assets/images/Svg.js
index 956fe45b..ab67d81e 100644
--- a/assets/images/Svg.js
+++ b/assets/images/Svg.js
@@ -58,10 +58,11 @@ type SvgType = {
name: string,
clasName?: string,
onClick?: () => void,
- "aria-label"?: string
+ "aria-label"?: string,
+ role?: string,
};
-function Svg({ name, className, onClick, "aria-label": ariaLabel }) {
+function Svg({ name, className, onClick, "aria-label": ariaLabel, role }) {
if (!svg[name]) {
const error = `Unknown SVG: ${name}`;
if (isDevelopment()) {
@@ -80,6 +81,7 @@ function Svg({ name, className, onClick, "aria-label": ariaLabel }) {
className,
onClick,
["aria-label"]: ariaLabel,
+ role,
src: svg[name]
};
return <InlineSVG {...props} />;
diff --git a/src/components/shared/SearchInput.js b/src/components/shared/SearchInput.js
index b8966fa1..2359ce6f 100644
--- a/src/components/shared/SearchInput.js
+++ b/src/components/shared/SearchInput.js
@@ -55,10 +55,10 @@ class SearchInput extends Component {
renderSvg() {
if (this.shouldShowErrorEmoji()) {
- return <Svg name="sad-face" />;
+ return <Svg name="sad-face" role="presentation" />;
}
- return <Svg name="magnifying-glass" />;
+ return <Svg name="magnifying-glass" role="presentation" />;
}
renderArrowButtons() {
input element should have a type of "search".
diff --git a/src/components/shared/SearchInput.js b/src/components/shared/SearchInput.js
index b8966fa1..3781cf6b 100644
--- a/src/components/shared/SearchInput.js
+++ b/src/components/shared/SearchInput.js
@@ -113,6 +113,7 @@ class SearchInput extends Component {
className: classnames({
empty: this.shouldShowErrorEmoji()
}),
+ type: "search",
onChange,
onKeyDown,
onKeyUp,
/claim
Hello, I will be working to fix this issue along with @belld19233, @emmet0r, @josezindia, and @Jessonsotoventura
Welcome @asharron, @belld19233, @emmet0r, @josezindia, and @Jessonsotoventura!
/claim
Thanks for claiming the issue! :wave:
Here are some link for getting setup, contributing, and development tips. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!