@algolia/autocomplete-js 1.19.1 → 1.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,6 +130,7 @@ export function createAutocompleteDom(_ref) {
130
130
  if (isDetached) {
131
131
  var detachedSearchButtonIcon = createDomElement('div', {
132
132
  class: classNames.detachedSearchButtonIcon,
133
+ ariaLabel: translations.detachedSearchButtonTitle,
133
134
  children: [SearchIcon({
134
135
  environment: environment
135
136
  })]
@@ -32,6 +32,7 @@ export function renderSearchBox(_ref) {
32
32
  setProperties(dom.loadingIndicator, {
33
33
  hidden: state.status !== 'stalled'
34
34
  });
35
+ toggleAnimation(dom.loadingIndicator, state.status === 'stalled');
35
36
  setProperties(dom.clearButton, {
36
37
  hidden: !state.query
37
38
  });
@@ -42,6 +43,23 @@ export function renderSearchBox(_ref) {
42
43
  hidden: Boolean(state.query)
43
44
  });
44
45
  }
46
+
47
+ // Safari will animate the SVG even when it's hidden. We need to pause the
48
+ // animation manually. See:
49
+ // - https://github.com/algolia/autocomplete/issues/1322
50
+ // - https://bugs.webkit.org/show_bug.cgi?id=298217
51
+ function toggleAnimation(element, isActive) {
52
+ var _element$firstChild;
53
+ var svgElement = ((_element$firstChild = element.firstChild) === null || _element$firstChild === void 0 ? void 0 : _element$firstChild.nodeName) === 'svg' ? element.firstChild : null;
54
+ if (!svgElement || !svgElement.pauseAnimations || !svgElement.unpauseAnimations) {
55
+ return;
56
+ }
57
+ if (isActive) {
58
+ svgElement.unpauseAnimations();
59
+ } else {
60
+ svgElement.pauseAnimations();
61
+ }
62
+ }
45
63
  export function renderPanel(render, _ref2) {
46
64
  var autocomplete = _ref2.autocomplete,
47
65
  autocompleteScopeApi = _ref2.autocompleteScopeApi,
@@ -1,4 +1,4 @@
1
- /*! @algolia/autocomplete-js 1.19.1 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.19.3 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -347,7 +347,7 @@
347
347
  return undefined;
348
348
  }
349
349
 
350
- var version = '1.19.1';
350
+ var version = '1.19.3';
351
351
 
352
352
  var userAgents$1 = [{
353
353
  segment: 'autocomplete-core',
@@ -3981,6 +3981,7 @@
3981
3981
  if (isDetached) {
3982
3982
  var detachedSearchButtonIcon = createDomElement('div', {
3983
3983
  class: classNames.detachedSearchButtonIcon,
3984
+ ariaLabel: translations.detachedSearchButtonTitle,
3984
3985
  children: [SearchIcon({
3985
3986
  environment: environment
3986
3987
  })]
@@ -4886,6 +4887,7 @@
4886
4887
  setProperties(dom.loadingIndicator, {
4887
4888
  hidden: state.status !== 'stalled'
4888
4889
  });
4890
+ toggleAnimation(dom.loadingIndicator, state.status === 'stalled');
4889
4891
  setProperties(dom.clearButton, {
4890
4892
  hidden: !state.query
4891
4893
  });
@@ -4896,6 +4898,23 @@
4896
4898
  hidden: Boolean(state.query)
4897
4899
  });
4898
4900
  }
4901
+
4902
+ // Safari will animate the SVG even when it's hidden. We need to pause the
4903
+ // animation manually. See:
4904
+ // - https://github.com/algolia/autocomplete/issues/1322
4905
+ // - https://bugs.webkit.org/show_bug.cgi?id=298217
4906
+ function toggleAnimation(element, isActive) {
4907
+ var _element$firstChild;
4908
+ var svgElement = ((_element$firstChild = element.firstChild) === null || _element$firstChild === void 0 ? void 0 : _element$firstChild.nodeName) === 'svg' ? element.firstChild : null;
4909
+ if (!svgElement || !svgElement.pauseAnimations || !svgElement.unpauseAnimations) {
4910
+ return;
4911
+ }
4912
+ if (isActive) {
4913
+ svgElement.unpauseAnimations();
4914
+ } else {
4915
+ svgElement.pauseAnimations();
4916
+ }
4917
+ }
4899
4918
  function renderPanel(render, _ref2) {
4900
4919
  var autocomplete = _ref2.autocomplete,
4901
4920
  autocompleteScopeApi = _ref2.autocompleteScopeApi,