Skip to content
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

fix(searchbox): add aria-hidden to svg icons #5547

Merged
merged 9 commits into from Mar 16, 2023
Expand Up @@ -38,6 +38,7 @@ Array [
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Expand Up @@ -37,6 +37,7 @@ Array [
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
1 change: 1 addition & 0 deletions examples/react/next/tests/__snapshots__/index.test.js.snap
Expand Up @@ -41,6 +41,7 @@ exports[`Next app recipes App renders without crashing 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Expand Up @@ -48,6 +48,7 @@ exports[`react-router recipe App renders without crashing 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Expand Up @@ -48,6 +48,7 @@ exports[`react-router recipe App renders without crashing 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Expand Up @@ -37,6 +37,7 @@ Array [
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Expand Up @@ -95,6 +95,7 @@ describe('refinementList', () => {
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
>
<path
d="M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"
Expand All @@ -112,6 +113,7 @@ describe('refinementList', () => {
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
>
<path
d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
Expand All @@ -128,6 +130,7 @@ describe('refinementList', () => {
stroke="#444"
viewBox="0 0 38 38"
width="16"
aria-hidden="true"
>
<g
fill="none"
Expand Down Expand Up @@ -277,6 +280,7 @@ describe('refinementList', () => {
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
>
<path
d="M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"
Expand All @@ -293,6 +297,7 @@ describe('refinementList', () => {
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
>
<path
d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
Expand All @@ -309,6 +314,7 @@ describe('refinementList', () => {
stroke="#444"
viewBox="0 0 38 38"
width="16"
aria-hidden="true"
>
<g
fill="none"
Expand Down
Expand Up @@ -65,6 +65,7 @@ describe('searchBox', () => {
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
Haroenv marked this conversation as resolved.
Show resolved Hide resolved
>
<path
d="M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"
Expand All @@ -82,6 +83,7 @@ describe('searchBox', () => {
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
>
<path
d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
Expand All @@ -98,6 +100,7 @@ describe('searchBox', () => {
stroke="#444"
viewBox="0 0 38 38"
width="16"
aria-hidden="true"
>
<g
fill="none"
Expand Down
Expand Up @@ -42,6 +42,7 @@ exports[`Menu Menu with search inside items but no search results 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -60,6 +61,7 @@ exports[`Menu Menu with search inside items but no search results 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -182,6 +184,7 @@ exports[`Menu Menu with search inside items with search results 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -200,6 +203,7 @@ exports[`Menu Menu with search inside items with search results 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -278,6 +282,7 @@ exports[`Menu applies translations 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -296,6 +301,7 @@ exports[`Menu applies translations 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Expand Up @@ -42,6 +42,7 @@ exports[`RefinementList applies translations 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -60,6 +61,7 @@ exports[`RefinementList applies translations 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -398,6 +400,7 @@ exports[`RefinementList refinement list with search inside items but no search r
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -416,6 +419,7 @@ exports[`RefinementList refinement list with search inside items but no search r
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -550,6 +554,7 @@ exports[`RefinementList refinement list with search inside items with search res
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -568,6 +573,7 @@ exports[`RefinementList refinement list with search inside items with search res
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Expand Up @@ -36,6 +36,7 @@ exports[`SearchBox applies its default props 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -54,6 +55,7 @@ exports[`SearchBox applies its default props 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -101,6 +103,7 @@ exports[`SearchBox applies its default props with custom className 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -119,6 +122,7 @@ exports[`SearchBox applies its default props with custom className 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -166,6 +170,7 @@ exports[`SearchBox lets you customize its theme 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -184,6 +189,7 @@ exports[`SearchBox lets you customize its theme 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -231,6 +237,7 @@ exports[`SearchBox lets you customize its translations 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -249,6 +256,7 @@ exports[`SearchBox lets you customize its translations 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -349,6 +357,7 @@ exports[`SearchBox should render the loader if showLoadingIndicator is true 1`]
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -367,6 +376,7 @@ exports[`SearchBox should render the loader if showLoadingIndicator is true 1`]
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -384,6 +394,7 @@ exports[`SearchBox should render the loader if showLoadingIndicator is true 1`]
stroke="#444"
viewBox="0 0 38 38"
width="18"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<g
Expand Down Expand Up @@ -456,6 +467,7 @@ exports[`SearchBox should render the loader if showLoadingIndicator is true 2`]
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -474,6 +486,7 @@ exports[`SearchBox should render the loader if showLoadingIndicator is true 2`]
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -491,6 +504,7 @@ exports[`SearchBox should render the loader if showLoadingIndicator is true 2`]
stroke="#444"
viewBox="0 0 38 38"
width="18"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<g
Expand Down Expand Up @@ -563,6 +577,7 @@ exports[`SearchBox transfers the autoFocus prop to the underlying input element
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -581,6 +596,7 @@ exports[`SearchBox transfers the autoFocus prop to the underlying input element
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -628,6 +644,7 @@ exports[`SearchBox treats its query prop as its input value 1`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -646,6 +663,7 @@ exports[`SearchBox treats its query prop as its input value 1`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -693,6 +711,7 @@ exports[`SearchBox treats its query prop as its input value 2`] = `
height="10"
viewBox="0 0 40 40"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -711,6 +730,7 @@ exports[`SearchBox treats its query prop as its input value 2`] = `
height="10"
viewBox="0 0 20 20"
width="10"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
3 changes: 3 additions & 0 deletions packages/react-instantsearch-hooks-web/src/ui/SearchBox.tsx
Expand Up @@ -84,6 +84,7 @@ function DefaultSubmitIcon({ classNames }: IconProps) {
width="10"
height="10"
viewBox="0 0 40 40"
aria-hidden="true"
>
<path d="M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"></path>
</svg>
Expand All @@ -97,6 +98,7 @@ function DefaultResetIcon({ classNames }: IconProps) {
viewBox="0 0 20 20"
width="10"
height="10"
aria-hidden="true"
>
<path d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"></path>
</svg>
Expand All @@ -111,6 +113,7 @@ function DefaultLoadingIcon({ classNames }: IconProps) {
viewBox="0 0 38 38"
stroke="#444"
className={cx('ais-SearchBox-loadingIcon', classNames.loadingIcon)}
aria-hidden="true"
>
<g fill="none" fillRule="evenodd">
<g transform="translate(1 1)" strokeWidth="2">
Expand Down