diff --git a/.eslintrc.js b/.eslintrc.js index aa273ecb39..2c82b0db8d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -112,7 +112,11 @@ module.exports = { globals: { $: 'readonly' }, }, { - files: ['wagtail/**/**'], + files: [ + 'wagtail/**/**', + 'client/src/entrypoints/documents/document-chooser-modal.js', + 'client/src/entrypoints/images/image-chooser-modal.js', + ], globals: { $: 'readonly', addMessage: 'readonly', diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 27cbd44e8a..ae37ae6ebb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -49,6 +49,7 @@ Changelog * Add the ability for choices to be separated by new lines instead of just commas within the form builder, commas will still be supported if used (Abdulmajeed Isa) * Add internationalisation UI to modeladmin (Andrés Martano) * Support chunking in `PageQuerySet.specific()` to reduce memory consumption (Andy Babic) + * Implement new tabs design across the admin interface (Steven Steinwand) * Fix: When using `simple_translations` ensure that the user is redirected to the page edit view when submitting for a single locale (Mitchel Cabuloy) * Fix: When previewing unsaved changes to `Form` pages, ensure that all added fields are correctly shown in the preview (Joshua Munn) * Fix: When Documents (e.g. PDFs) have been configured to be served inline via `WAGTAILDOCS_CONTENT_TYPES` & `WAGTAILDOCS_INLINE_CONTENT_TYPES` ensure that the filename is correctly set in the `Content-Disposition` header so that saving the files will use the correct filename (John-Scott Atlakson) @@ -68,6 +69,7 @@ Changelog * Fix: Page copy in Wagtail admin ignores `exclude_fields_in_copy` (John-Scott Atlakson) * Fix: Translation key `IntegrityError` when publishing pages with translatable `Orderable`s that were copied without being published (Kalob Taulien, Dan Braghis) * Fix: Ignore `GenericRelation` when copying pages (John-Scott Atlakson) + * Fix: Implement ARIA tabs markup and keyboards interactions for admin tabs (Steven Steinwand) 2.16.2 (11.04.2022) diff --git a/client/scss/components/_header.scss b/client/scss/components/_header.scss index 1ab80e4dad..c3dca18e00 100644 --- a/client/scss/components/_header.scss +++ b/client/scss/components/_header.scss @@ -69,28 +69,6 @@ header { margin-bottom: 0; } - &.tab-merged { - padding-inline-start: $desktop-nice-padding; - padding-inline-end: $desktop-nice-padding; - - .right:last-child { - padding-inline-end: 0; - } - - @include media-breakpoint-down(xs) { - .breadcrumb { - padding-inline-start: calc(#{$desktop-nice-padding} - 8px); - } - } - @include media-breakpoint-up(sm) { - .breadcrumb { - margin-inline-start: -$desktop-nice-padding; - margin-inline-end: -$desktop-nice-padding; - padding-inline-start: math.div($desktop-nice-padding, 2); - } - } - } - &.header-with-breadcrumb { padding-top: 0; @@ -103,7 +81,6 @@ header { } } - &.tab-merged, &.no-border { border: 0; diff --git a/client/scss/components/_modals.scss b/client/scss/components/_modals.scss index 9878274d34..183cd96ffe 100644 --- a/client/scss/components/_modals.scss +++ b/client/scss/components/_modals.scss @@ -124,10 +124,6 @@ $zindex-modal-background: 500; h1 { @apply w-text-white; } - - &.tab-merged { - padding-inline-start: 1.6em; - } } .header-title { @@ -135,22 +131,12 @@ $zindex-modal-background: 500; padding-inline-start: 0 !important; margin-inline-start: -36px; } - - .tab-merged .header-title { - margin-inline-start: 0; - } } @include media-breakpoint-up(sm) { .modal-dialog { padding: 0 0 2em $menu-width; } - - .modal-body { - header.tab-merged { - padding-inline-start: $desktop-nice-padding; - } - } } @include media-breakpoint-up(xl) { diff --git a/client/scss/components/_tabs.scss b/client/scss/components/_tabs.scss index b80745364b..fc5f46e182 100644 --- a/client/scss/components/_tabs.scss +++ b/client/scss/components/_tabs.scss @@ -1,111 +1,4 @@ -.tab-nav { - @apply w-bg-grey-50; - @include row(); - padding: 0; - - li { - list-style-type: none; - width: 33%; - float: left; - padding: 0; - position: relative; - margin-inline-end: 2px; - - &:first-of-type { - padding-inline-start: $desktop-nice-padding; - margin-inline-start: 0; - } - } - - h2 { - margin: 0; - font-size: inherit; - } - - a { - // border-top 0.3em is temporary until the new tab design is implemented - @apply w-bg-primary w-border-t-[0.3em] w-border-primary-200; - @include transition(border-color 0.2s ease); - font-weight: 600; - text-decoration: none; - display: block; - padding: 0.6em 0.7em 0.8em; - color: $color-white; - max-height: 1.44em; - overflow: hidden; - - &:hover { - color: $color-white; - border-top-color: rgba(0, 0, 0, 0.35); - } - } - - a.errors { - &:after { - border-radius: 50px; - box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.1); - position: absolute; - // Remove once we drop support for Safari 13. - // stylelint-disable-next-line property-disallowed-list - right: -0.5em; - inset-inline-end: -0.5em; - top: -0.5em; - z-index: 5; - min-width: 0.9em; - color: $color-white; - background: $color-red; - content: attr(data-count); - padding: 0 0.3em; - line-height: 1.4em; - text-align: center; - font-size: 0.8em; - } - } - - li.active a { - box-shadow: none; - color: $color-grey-1; - background-color: $color-white; - border-top: 0.3em solid $color-grey-1; - } - - // For cases where tab-nav should merge with header - .page-editor & { - &.merged { - @apply w-pt-2 sm:w-pt-4; - } - } - - &.merged { - @apply w-mt-0; - } - - li.right { - float: right; - margin-inline-end: 0; - margin-inline-start: 2px; - } - - li.wide { - width: unset; - } - - .right { - max-height: 1.44em; - overflow: visible; - } -} - .tab-content { - > section { - display: none; - padding-top: 1em; - - &.active { - display: block; - } - } - .page-locked & { cursor: not-allowed; user-select: none; @@ -116,53 +9,72 @@ } } -@include media-breakpoint-up(sm) { - .tab-nav { - // For cases where tab-nav should merge with header - &.merged { - @apply w-bg-grey-50; - } +.w-tabs { + &__wrapper { + @apply w-mb-10 w-overflow-x-auto w-scrollbar-thin; + } - li { - width: auto; - padding: 0; - } + &__list { + @include nice-padding(); + @apply w-flex w-my-[3px] w-space-x-6 w-border-b w-border-grey-100 w-w-fit; + } - a { - padding-inline-start: $mobile-nice-padding; - padding-inline-end: $mobile-nice-padding; - } + &__tab { + @apply w-label-3 + w-box-border + w-inline-flex + w-text-grey-400 + hover:w-text-primary + w-whitespace-nowrap + w-py-4 + w-font-medium + w-relative + after:w-block + after:w-w-0 + after:w-h-[2px] + after:w-bg-primary + after:w-absolute + after:w-left-0 + after:-w-bottom-px + after:w-transition-all + motion-reduce:after:w-transition-none + hover:after:w-w-full; - li.settings a { - padding-inline-start: 2em; - padding-inline-end: 2em; + &[aria-selected='true'] { + @apply after:w-w-full w-text-primary; } } - .modal-content .tab-nav li { - padding: 0; - min-width: 0; + &__errors { + @apply w-hidden + w-box-border + w-w-4 + w-h-4 + w-text-[0.75rem] + w-flex + w-justify-center + w-items-center + w-font-bold + w-bg-critical-200 + w-text-white + w-border + w-border-white + w-rounded-full + w-absolute + w-top-[0.4375rem] + -w-right-[0.9375rem]; - &:first-of-type { - padding-inline-start: $desktop-nice-padding; + &--active { + @apply w-flex; + } + } + + // Optional animate attr for tabs to animate in + &[data-tabs-animate] &__panel { + @apply motion-reduce:w-transition-none w-transition w-duration-150 w-translate-y-1 w-opacity-0; + + &.animate-in { + @apply w-translate-y-0 w-opacity-100; } } } - -@include media-breakpoint-down(xs) { - // To allow tabs on the edit page to be editable - .tab-nav li:first-of-type { - padding-inline-start: 1.6em; - } - - .tab-nav li { - width: auto; - } -} - -// Media for Windows High Contrast -@media (forced-colors: $media-forced-colours) { - .tab-nav li.active a { - border-bottom: 0.3em solid $system-color-link-text; - } -} diff --git a/client/scss/core.scss b/client/scss/core.scss index fb6b03b54f..d25f21d760 100644 --- a/client/scss/core.scss +++ b/client/scss/core.scss @@ -154,7 +154,6 @@ These are classes that provide overrides. @import 'overrides/utilities.dropdowns'; @import 'overrides/utilities.focus'; @import 'overrides/utilities.visuallyhidden'; -@import 'overrides/utilities.scrollbars'; // Legacy utilities @import 'overrides/utilities.legacy'; diff --git a/client/scss/elements/_elements.scss b/client/scss/elements/_elements.scss index d65d86a35f..7f52335135 100644 --- a/client/scss/elements/_elements.scss +++ b/client/scss/elements/_elements.scss @@ -45,3 +45,8 @@ img { border-width: 0; border-style: solid; } + +::before, +::after { + --tw-content: ''; +} diff --git a/client/scss/overrides/_utilities.scrollbars.scss b/client/scss/overrides/_utilities.scrollbars.scss deleted file mode 100644 index 1e5e91d958..0000000000 --- a/client/scss/overrides/_utilities.scrollbars.scss +++ /dev/null @@ -1,25 +0,0 @@ -.u-scrollbar-thin { - // Scrollbar styling for firefox - // https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-color - scrollbar-color: theme('colors.grey.100') theme('colors.white.DEFAULT'); - scrollbar-width: thin; - - //Custom scrollbar styling for Safari & Chrome Windows / Mac / Android. - &::-webkit-scrollbar { - width: 5px; - height: 5px; - } - - &::-webkit-scrollbar-button { - @apply w-hidden; - // Hide the scrollbar arrows on windows - } - - &::-webkit-scrollbar-thumb { - @apply w-bg-grey-200 w-rounded-sm; - } - - &::-webkit-scrollbar-track { - @apply w-bg-white; - } -} diff --git a/client/src/components/Sidebar/modules/MainMenu.tsx b/client/src/components/Sidebar/modules/MainMenu.tsx index 5971add2d1..f270bf5bb5 100644 --- a/client/src/components/Sidebar/modules/MainMenu.tsx +++ b/client/src/components/Sidebar/modules/MainMenu.tsx @@ -202,7 +202,7 @@ export const Menu: React.FunctionComponent = ({ }; const className = - 'sidebar-main-menu u-scrollbar-thin' + + 'sidebar-main-menu w-scrollbar-thin' + (accountSettingsOpen ? ' sidebar-main-menu--open-footer' : ''); return ( diff --git a/client/src/components/Sidebar/modules/__snapshots__/MainMenu.test.js.snap b/client/src/components/Sidebar/modules/__snapshots__/MainMenu.test.js.snap index 2364662dde..2a144c786d 100644 --- a/client/src/components/Sidebar/modules/__snapshots__/MainMenu.test.js.snap +++ b/client/src/components/Sidebar/modules/__snapshots__/MainMenu.test.js.snap @@ -4,7 +4,7 @@ exports[`Menu should render with the minimum required props 1`] = `