chore(v2): remove docsearch a11y workaround

This commit is contained in:
endiliey 2019-05-13 22:19:31 +08:00
parent b61cab5e9b
commit ffdd3e60fc
3 changed files with 22 additions and 8 deletions

View file

@ -8,7 +8,7 @@
},
"license": "MIT",
"dependencies": {
"docsearch.js": "^2.6.x"
"docsearch.js": "^2.6.3"
},
"peerDependencies": {
"@docusaurus/core": "^2.0.0",

View file

@ -28,11 +28,6 @@ class Search extends React.Component {
// https://github.com/algolia/docsearch/issues/352
const isClient = typeof window !== 'undefined';
if (isClient) {
// Temporary workaround for a11y issue
// https://github.com/algolia/docsearch/issues/418#
const docsearchInput = document.querySelector('#search_input_react');
const ariaLabel = docsearchInput.getAttribute('aria-label');
import('docsearch.js').then(({default: docsearch}) => {
docsearch({
appId: algolia.appId,
@ -41,7 +36,6 @@ class Search extends React.Component {
inputSelector: '#search_input_react',
algoliaOptions: algolia.algoliaOptions,
});
docsearchInput.setAttribute('aria-label', ariaLabel);
});
} else {
console.warn('Search has failed to load and now is being disabled');

View file

@ -2481,6 +2481,13 @@ autocomplete.js@0.33.0:
dependencies:
immediate "^3.2.3"
autocomplete.js@0.36.0:
version "0.36.0"
resolved "https://registry.yarnpkg.com/autocomplete.js/-/autocomplete.js-0.36.0.tgz#94fe775fe64b6cd42e622d076dc7fd26bedd837b"
integrity sha512-jEwUXnVMeCHHutUt10i/8ZiRaCb0Wo+ZyKxeGsYwBDtw6EJHqEeDrq4UwZRD8YBSvp3g6klP678il2eeiVXN2Q==
dependencies:
immediate "^3.2.3"
autolinker@~0.15.0:
version "0.15.3"
resolved "https://registry.yarnpkg.com/autolinker/-/autolinker-0.15.3.tgz#342417d8f2f3461b14cf09088d5edf8791dc9832"
@ -4607,7 +4614,7 @@ dns-txt@^2.0.2:
dependencies:
buffer-indexof "^1.0.0"
docsearch.js@^2.5.2, docsearch.js@^2.6.x:
docsearch.js@^2.5.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/docsearch.js/-/docsearch.js-2.6.2.tgz#cb36a97aeac8a8d31eed5915cdee808a2248b41c"
integrity sha512-qyQ+raZlHSkfdpFg8wJNhjiz9WsjdQkRGe2LiiKS6vIIsouNNole2Kg/9UvGoUIK9PLLl31uL3I4YDwnrXt5yQ==
@ -4620,6 +4627,19 @@ docsearch.js@^2.5.2, docsearch.js@^2.6.x:
to-factory "^1.0.0"
zepto "^1.2.0"
docsearch.js@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/docsearch.js/-/docsearch.js-2.6.3.tgz#57cb4600d3b6553c677e7cbbe6a734593e38625d"
integrity sha512-GN+MBozuyz664ycpZY0ecdQE0ND/LSgJKhTLA0/v3arIS3S1Rpf2OJz6A35ReMsm91V5apcmzr5/kM84cvUg+A==
dependencies:
algoliasearch "^3.24.5"
autocomplete.js "0.36.0"
hogan.js "^3.0.2"
request "^2.87.0"
stack-utils "^1.0.1"
to-factory "^1.0.0"
zepto "^1.2.0"
doctrine@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa"