You are here

autocomplete-loading.module.pcss.css in Drupal 9

Visual styles for animated throbber.

See also

autocomplete.js

File

core/themes/claro/css/components/autocomplete-loading.module.pcss.css
View source
  1. /**
  2. * @file
  3. * Visual styles for animated throbber.
  4. *
  5. * @see autocomplete.js
  6. */
  7. @import "../base/variables.pcss.css";
  8. /**
  9. * Since the autocomplete library is attached conditionally and not globally,
  10. * we can be 99% sure that the default icon will be used.
  11. * With inline SVGs we can prevent a HTTP request and repaint addressing the
  12. * autocomplete input's background — until are sure that it will be pushed by
  13. * the server with HTTP/2.
  14. *
  15. * The autocompleting (active) state's background-image is inlined because
  16. * non-used CSS selectors are usually ignored; popular browsers don't download
  17. * their 'url' references.
  18. * If these selectors become active, the browser needs some time for painting
  19. * previously ignored remote asset: it should get it from server, parse it and
  20. * repaint the background of autocomplete field. With the inlined background we
  21. * can prevent an additional timeout caused by a new request/response pair.
  22. * Besides this, the autocompleting event itself may easily finish before the
  23. * missing asset gets downloaded/parsed/painted, and the missing instant visual
  24. * feedback would be a usability/accessibility issue as well.
  25. */
  26. .js .form-autocomplete {
  27. background-image: url(../../images/icons/868686/magnifier.svg);
  28. background-repeat: no-repeat;
  29. background-position: 100% 50%;
  30. }
  31. .js .form-autocomplete::-ms-clear {
  32. display: none;
  33. }
  34. .js[dir="rtl"] .form-autocomplete {
  35. background-image: url(../../images/icons/868686/magnifier-rtl.svg);
  36. background-position: 0 50%;
  37. }
  38. .js .form-autocomplete.is-autocompleting {
  39. background-image: url(../../images/icons/004adc/spinner.svg);
  40. }
  41. .js[dir="rtl"] .form-autocomplete.is-autocompleting {
  42. background-image: url(../../images/icons/004adc/spinner-rtl.svg);
  43. }
  44. /* IE11 does not animate inline SVG. */
  45. /* stylelint-disable-next-line selector-type-no-unknown */
  46. _:-ms-fullscreen,
  47. .js .form-autocomplete.is-autocompleting {
  48. background-image: url("../../images/spinner-ltr.gif");
  49. background-size: 2.5rem 1.25rem;
  50. }
  51. /* stylelint-disable-next-line selector-type-no-unknown */
  52. _:-ms-fullscreen,
  53. .js[dir="rtl"] .form-autocomplete.is-autocompleting {
  54. background-image: url("../../images/spinner-rtl.gif");
  55. }
  56. /**
  57. * Autocomplete wrapper for autocompleting message.
  58. */
  59. .claro-autocomplete {
  60. position: relative;
  61. display: inline-block;
  62. max-width: 100%;
  63. }
  64. .claro-autocomplete__message {
  65. position: absolute;
  66. right: 0;
  67. bottom: 100%;
  68. max-width: 100%;
  69. margin-bottom: 0.15rem;
  70. color: var(--color-link);
  71. font-size: var(--font-size-xxs); /* ~11px */
  72. font-weight: bold;
  73. line-height: calc(18rem / 16); /* 18px */
  74. }
  75. [dir="rtl"] .claro-autocomplete__message {
  76. right: auto;
  77. left: 0;
  78. }