_title.scss 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Styles for title fields throughout the page.
  2. // The `title` class is meant to be applied by end users throughout different forms APIs.
  3. :where(.w-panel, .w-field).title {
  4. :where(input, textarea, .Draftail-Editor .public-DraftEditor-content) {
  5. @apply w-h2;
  6. color: theme('colors.text-context');
  7. }
  8. }
  9. // Styles for the title field when at the top of the page.
  10. // It’s the first panel when comments are disabled, second if enabled.
  11. .w-panel.title:nth-child(-n + 2) {
  12. .w-panel__header {
  13. @apply w-sr-only;
  14. .w-panel__anchor,
  15. .w-panel__toggle {
  16. @apply w-hidden;
  17. }
  18. }
  19. .w-field {
  20. display: grid;
  21. }
  22. // Force the help text after the field as the field also visually acts as page heading.
  23. .w-field__help {
  24. order: 2;
  25. }
  26. :is(input, textarea, .Draftail-Editor .public-DraftEditor-content) {
  27. @apply w-h1;
  28. color: theme('colors.text-context');
  29. // Slightly out-dented so the field’s is horizontally aligned.
  30. padding-inline-start: theme('spacing[1.5]');
  31. margin-inline-start: calc(-1 * theme('spacing[1.5]'));
  32. .w-density-snug & {
  33. font-size: theme('fontSize.26');
  34. }
  35. // Avoid calling attention to the field _unless_ it’s in one of those states.
  36. &:not(:hover, :focus, :placeholder-shown, [aria-invalid='true']) {
  37. // Hide w/ transparency to preserve border size and show it in forced-colors mode.
  38. border-color: transparent;
  39. }
  40. }
  41. }