autocomplete-loading.module.pcss.css

Same filename in this branch
  1. 11.x core/themes/olivero/css/components/autocomplete-loading.module.pcss.css
Same filename in other branches
  1. 9 core/themes/olivero/css/components/autocomplete-loading.module.pcss.css
  2. 9 core/themes/claro/css/components/autocomplete-loading.module.pcss.css
  3. 8.9.x core/themes/claro/css/components/autocomplete-loading.module.pcss.css
  4. 10 core/themes/olivero/css/components/autocomplete-loading.module.pcss.css
  5. 10 core/themes/claro/css/components/autocomplete-loading.module.pcss.css

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. /* cspell:ignore is-autocompleting */
  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 active autocomplete state's background-image is inlined because non-used
  16. * CSS selectors are usually ignored; popular browsers don't download their
  17. * '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 autocomplete 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 {
  27. & .form-autocomplete {
  28. margin-inline-end: calc(var(--input-border-size) - 1.5 * var(--input-padding-horizontal));
  29. padding-inline-end: calc(var(--input-padding-horizontal) * 2.5 - var(--input-border-size));
  30. background-image: url(../../images/icons/868686/magnifier.svg);
  31. background-repeat: no-repeat;
  32. background-position: 100% 50%;
  33. &.is-autocompleting {
  34. background-image: url(../../images/icons/003ecc/spinner.svg);
  35. background-position: center right -10px;
  36. }
  37. }
  38. &[dir="rtl"] {
  39. & .form-autocomplete {
  40. background-image: url(../../images/icons/868686/magnifier-rtl.svg);
  41. background-position: 0 50%;
  42. &.is-autocompleting {
  43. background-image: url(../../images/icons/003ecc/spinner-rtl.svg);
  44. background-position: center left 10px;
  45. }
  46. }
  47. }
  48. }
  49. /**
  50. * Autocomplete wrapper for autocomplete message.
  51. */
  52. .claro-autocomplete {
  53. position: relative;
  54. display: inline-block;
  55. max-width: 100%;
  56. }
  57. .claro-autocomplete__message {
  58. position: absolute;
  59. inset-inline-end: 0;
  60. inset-block-end: 100%;
  61. max-width: 100%;
  62. margin-block-end: 0.15rem;
  63. color: var(--color-link);
  64. font-size: var(--font-size-xxs); /* ~11px */
  65. font-weight: bold;
  66. line-height: calc(18rem / 16); /* 18px */
  67. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.