Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply visible focus design guidelines in all components #1437

Merged
merged 97 commits into from Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
6822bbc
Add new mixin and first test on form controls
MewenLeHo Aug 2, 2022
eb8629e
Add new focus to buttons
MewenLeHo Aug 4, 2022
98b50a5
Fix hover effect on focus for buttons
MewenLeHo Aug 4, 2022
0b3373d
Refactoring
MewenLeHo Aug 5, 2022
686a962
Fix for carousels
MewenLeHo Aug 5, 2022
6e8a809
Fix for social buttons
MewenLeHo Aug 5, 2022
9271562
Fix after review
MewenLeHo Aug 8, 2022
cd6f53b
Fix hover on dark social buttons when focus
MewenLeHo Aug 9, 2022
f24f71a
Focus on select
MewenLeHo Aug 9, 2022
32e30de
Focus on checkboxes and radios
MewenLeHo Aug 9, 2022
cc52e1c
Focus on links and links with chevron
MewenLeHo Aug 10, 2022
5dfada4
Fix after review
MewenLeHo Aug 10, 2022
35a7a62
Fix hover on focused link with chevron
MewenLeHo Aug 10, 2022
c04e1ed
Focus on star rating
MewenLeHo Aug 11, 2022
fe46e2d
Focus on close button
MewenLeHo Aug 11, 2022
4bf92d2
Focus on toggle buttons
MewenLeHo Aug 11, 2022
731fd49
Focus on switches
MewenLeHo Aug 16, 2022
5fff532
Focus on nav & tabs
MewenLeHo Aug 17, 2022
af3dd9c
Focus on pagination
MewenLeHo Aug 17, 2022
d88bb48
Focus on responsive tables
MewenLeHo Aug 17, 2022
9b5c1cb
Focus on validation
MewenLeHo Aug 17, 2022
c4eb2c7
Focus on list group
MewenLeHo Aug 17, 2022
9884dc3
Focus on accordions
MewenLeHo Aug 19, 2022
cb08970
Focus on navbar and dropdowns
MewenLeHo Aug 19, 2022
00e1d01
Fixes from my review
louismaximepiton Aug 26, 2022
e7eacb8
Proposal for Stepped-process
louismaximepiton Aug 29, 2022
deb7c9f
Search + remove box-shadow on close button
louismaximepiton Aug 29, 2022
ee0bc52
Proposal to have less to maintain/decrease bundle size
louismaximepiton Aug 29, 2022
ba44386
Put values in Sass variables
louismaximepiton Aug 29, 2022
89b8881
.
louismaximepiton Aug 29, 2022
18ab2a3
Fix(spec meeting)
louismaximepiton Aug 30, 2022
a3fd645
Focus on range
MewenLeHo Sep 5, 2022
8be1d3b
Focus on range for keyboard only
MewenLeHo Sep 5, 2022
f0cecc1
Focus on list group
MewenLeHo Sep 7, 2022
12563e6
Focus on list group but only on keyboard
MewenLeHo Sep 7, 2022
b2ac0a7
Fix indentation
MewenLeHo Sep 8, 2022
2332364
Add new mixin for box shadow
MewenLeHo Sep 9, 2022
c988c0f
Refactoring and bug fixing
MewenLeHo Sep 9, 2022
efcf64a
First round of fixes
MewenLeHo Sep 14, 2022
970f492
Second round of fixes
MewenLeHo Sep 14, 2022
980da2e
Third round of fixes
MewenLeHo Sep 14, 2022
2767f6a
Third round of fixes
MewenLeHo Sep 15, 2022
8702822
Final round of fixes
MewenLeHo Sep 15, 2022
63a8349
Fixes after review
MewenLeHo Oct 10, 2022
30258d4
Update config for jobs
MewenLeHo Oct 11, 2022
dbfef9a
Update docs
MewenLeHo Oct 11, 2022
d8ee73b
Restore polyfill
MewenLeHo Oct 14, 2022
2d16e5b
Fix sri
MewenLeHo Oct 26, 2022
32ecdc4
Small fixes
louismaximepiton Nov 21, 2022
ed66bb5
Fixes
louismaximepiton Dec 7, 2022
f5f2966
.
louismaximepiton Dec 7, 2022
b08543f
First try whith new outline colors
MewenLeHo Dec 9, 2022
48bd406
Test wit new blue water-200 #4170d8
MewenLeHo Dec 9, 2022
88b94a6
Prevent potential side effect with white outline on white background …
MewenLeHo Dec 9, 2022
9ce7553
New test with black outline and white box shadow everywhere
MewenLeHo Dec 9, 2022
764fdec
New version with switching black outer and white inner outlines
MewenLeHo Dec 13, 2022
ba0aa35
New test
MewenLeHo Dec 13, 2022
c0108e8
Update documentation
MewenLeHo Dec 13, 2022
816c403
Merge branch 'main' into main-mlh-apply-new-visible-focus-all-components
MewenLeHo Dec 14, 2022
7ed4c74
Fixes after review
MewenLeHo Dec 14, 2022
d69d89f
Merge branch 'main-mlh-apply-new-visible-focus-all-components' of htt…
MewenLeHo Dec 14, 2022
1f46f95
Quick fix
MewenLeHo Dec 14, 2022
48af13f
Fixes after review
MewenLeHo Dec 14, 2022
8f71ce5
Resolve conflicts
MewenLeHo Dec 19, 2022
b7e09b2
Fixes
MewenLeHo Dec 19, 2022
f4f233f
Merge branch 'main' into main-mlh-apply-new-visible-focus-all-components
MewenLeHo Dec 20, 2022
268483a
Fixes
MewenLeHo Dec 20, 2022
9d3b852
Merge branch 'main-mlh-apply-new-visible-focus-all-components' of htt…
MewenLeHo Dec 20, 2022
99b5c02
Merge branch 'main' into main-mlh-apply-new-visible-focus-all-components
julien-deramond Dec 22, 2022
c2d7e6e
Fix added-in
julien-deramond Dec 22, 2022
29fe564
.
julien-deramond Dec 22, 2022
0c95967
Fix after review
MewenLeHo Dec 22, 2022
ea99c6d
Fix
MewenLeHo Dec 23, 2022
c188735
Merge branch 'main' into main-mlh-apply-new-visible-focus-all-components
louismaximepiton Dec 28, 2022
7212944
Remove unnecessary rule
louismaximepiton Dec 28, 2022
ddfce4b
.
julien-deramond Dec 29, 2022
6d4c139
Small fixes
louismaximepiton Dec 29, 2022
6e5f70c
Quick fixes
louismaximepiton Dec 29, 2022
edc8a1f
Approved version
louismaximepiton Dec 29, 2022
7a9d1e8
Update bundlewatch
julien-deramond Dec 30, 2022
7bb4a86
Move focus code in the right place
julien-deramond Dec 30, 2022
50dffe0
Add boosted mod
julien-deramond Dec 30, 2022
decde62
Add migration guide note
julien-deramond Dec 30, 2022
7a3d4cd
Boosted mods
julien-deramond Dec 30, 2022
ea1445d
Minor modif _list-group.scss
julien-deramond Dec 30, 2022
c3eaee6
Minor boosted mod modifs
julien-deramond Dec 30, 2022
89cd7d3
Minor boosted mod modifs
julien-deramond Dec 30, 2022
0614347
Minor boosted mod modifs
julien-deramond Dec 30, 2022
b12bc86
Introduce new variable
louismaximepiton Dec 30, 2022
fbf3485
Minor boosted mod modifs
julien-deramond Dec 30, 2022
e6c6ba9
Changed only when necessary
louismaximepiton Dec 30, 2022
2d0ce86
Minor boosted mod modifs
julien-deramond Dec 30, 2022
05f4975
Reintroduce transition-focus Sass var
julien-deramond Dec 30, 2022
92d361e
transition-focus -> null
julien-deramond Dec 30, 2022
8c6ced6
handle deprecated/new css/sass vars
julien-deramond Dec 30, 2022
dd6b680
fix form range thumb transition
julien-deramond Dec 30, 2022
2859c70
Add info about the removal of the transition animation in the migrati…
julien-deramond Dec 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .bundlewatch.config.json
Expand Up @@ -26,11 +26,11 @@
},
{
"path": "./dist/css/boosted.css",
"maxSize": "38.75 kB"
"maxSize": "38.5 kB"
},
{
"path": "./dist/css/boosted.min.css",
"maxSize": "36.0 kB"
"maxSize": "35.5 kB"
},
{
"path": "./dist/js/boosted.bundle.js",
Expand All @@ -42,7 +42,7 @@
},
{
"path": "./dist/js/boosted.esm.js",
"maxSize": "33.25 kB"
"maxSize": "33.0 kB"
},
{
"path": "./dist/js/boosted.esm.min.js",
Expand Down
2 changes: 1 addition & 1 deletion js/index.esm.js
Expand Up @@ -14,7 +14,7 @@ export { default as Collapse } from './src/collapse'
export { default as Dropdown } from './src/dropdown'
export { default as Modal } from './src/modal'
export { default as Offcanvas } from './src/offcanvas'
export { default as OrangeNavbar } from './src/orange-navbar'
export { default as OrangeNavbar } from './src/orange-navbar' // Boosted mod
export { default as Popover } from './src/popover'
export { default as QuantitySelector } from './src/quantity-selector' // Boosted mod
export { default as ScrollSpy } from './src/scrollspy'
Expand Down
4 changes: 2 additions & 2 deletions js/index.umd.js
Expand Up @@ -12,7 +12,7 @@ import Collapse from './src/collapse'
import Dropdown from './src/dropdown'
import Modal from './src/modal'
import Offcanvas from './src/offcanvas'
import OrangeNavbar from './src/orange-navbar'
import OrangeNavbar from './src/orange-navbar' // Boosted mod
import Popover from './src/popover'
import QuantitySelector from './src/quantity-selector' // Boosted mod
import ScrollSpy from './src/scrollspy'
Expand All @@ -29,7 +29,7 @@ export default {
Dropdown,
Modal,
Offcanvas,
OrangeNavbar,
OrangeNavbar, // Boosted mod
Popover,
QuantitySelector, // Boosted mod
ScrollSpy,
Expand Down
8 changes: 6 additions & 2 deletions scss/_accordion.scss
Expand Up @@ -74,8 +74,12 @@
}

&:focus {
z-index: 3;
outline-offset: calc(-1 * var(--#{$prefix}accordion-border-width)); /* stylelint-disable-line function-disallowed-list */ // Boosted mod
// Boosted mod
&[data-focus-visible-added] {
outline-offset: add($focus-visible-outer-offset, var(--#{$prefix}accordion-border-width));
box-shadow: 0 0 0 add(var(--#{$prefix}accordion-border-width), $focus-visible-inner-width) var(--#{$prefix}focus-visible-inner-color);
}
// End mod
}
}

Expand Down
3 changes: 1 addition & 2 deletions scss/_back-to-top.scss
Expand Up @@ -66,8 +66,7 @@
background-color: var(--#{$prefix}back-to-top-title-bg-color);
}

&[data-#{$prefix}label]:hover::before,
&[data-#{$prefix}label]:focus::before {
&[data-#{$prefix}label]:hover::before {
text-decoration: var(--#{$prefix}back-to-top-title-active-decoration);
}
}
Expand Down
41 changes: 6 additions & 35 deletions scss/_buttons.scss
Expand Up @@ -39,7 +39,6 @@
cursor: if($enable-button-pointers, pointer, null);
user-select: none;
border: var(--#{$prefix}btn-border-width) solid var(--#{$prefix}btn-border-color);
outline-offset: map-get($spacers, 1); // Boosted mod
@include border-radius(var(--#{$prefix}btn-border-radius));
@include gradient-bg(var(--#{$prefix}btn-bg));
@include box-shadow(var(--#{$prefix}btn-box-shadow));
Expand All @@ -54,25 +53,11 @@

// Boosted mod: no .btn-check + &:hover

&:focus { // Boosted mod: no &:focus-visible to avoid issue in button tags
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
color: var(--#{$prefix}btn-hover-color);
@include gradient-bg(var(--#{$prefix}btn-hover-bg));
border-color: var(--#{$prefix}btn-hover-border-color);
// Boosted mod: no outline: 0;
outline-color: var(--#{$prefix}btn-hover-border-color); // Boosted mod
outline-offset: $outline-width; // Boosted mod
&[data-focus-visible-added] { // Boosted mod: added `&[data-focus-visible-added]`
// Avoid using mixin so we can pass custom focus shadow properly
@if $enable-shadows {
box-shadow: var(--#{$prefix}btn-box-shadow), var(--#{$prefix}btn-focus-box-shadow);
} @else {
box-shadow: var(--#{$prefix}btn-focus-box-shadow);
}
}
}

// Boosted mod: no `.btn-check:focus-visible + &` rule to remove the outline

// Boosted mod: no &:focus-visible to avoid issue in button tags

// Boosted mod: custom styles for .btn-check
// Boosted mod: simpler rule
&:active,
&.active,
Expand All @@ -82,7 +67,6 @@
// Remove CSS gradients if they're enabled
background-image: if($enable-gradients, none, null);
border-color: var(--#{$prefix}btn-active-border-color);
outline-color: var(--#{$prefix}btn-active-border-color); // Boosted mod
// Boosted mod: no box shadow modification for the active state
}

Expand Down Expand Up @@ -154,7 +138,7 @@

// Boosted mod: no .btn-outline

// Boosted mod: border-only on :hover, :focus and :active
// Boosted mod: border-only on :hover and :active
.btn-no-outline {
--#{$prefix}btn-hover-border-color: #{$gray-500};
--#{$prefix}btn-active-color: #{$accessible-orange};
Expand Down Expand Up @@ -202,18 +186,9 @@
text-decoration: $link-hover-decoration;
}

// Boosted mod
&:focus-visible {
&:not(:hover) {
color: var(--#{$prefix}btn-color);
outline-color: var(--#{$prefix}btn-color);
}

&:hover {
outline-color: var(--#{$prefix}btn-active-color);
}
}
// Boosted mod: no focus-visible color change

// Boosted mod: btn inverse
&.btn-inverse {
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
--#{$prefix}btn-disabled-color: #{$gray-700};
}
Expand Down Expand Up @@ -257,10 +232,6 @@
@include border-radius(50%, 50%);
@include button-icon(var(--#{$boosted-prefix}network-logo));

&:focus {
outline-color: var(--#{$boosted-prefix}network-color, $black);
}

&.btn-inverse {
--#{$prefix}btn-color: #{$white};
--#{$prefix}btn-active-color: #{$black};
Expand Down
17 changes: 7 additions & 10 deletions scss/_carousel.scss
Expand Up @@ -102,12 +102,13 @@
background: none;
border: 0;
outline: 0; // Boosted mod
box-shadow: none; // Boosted mod
opacity: $carousel-control-opacity;
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
@include transition($carousel-control-transition);

// Boosted mod: no focus
// Hover/focus state
&:hover,
&:focus {
&:hover {
--#{$boosted-prefix}control-bg: #{color-contrast($carousel-indicator-active-bg)}; // Boosted mod
color: color-contrast($carousel-control-color);
text-decoration: none;
Expand All @@ -126,16 +127,15 @@
color: $carousel-control-color;
}

// scss-docs-start focus-visible-carousel
&:focus {
&[data-focus-visible-added] {
// stylelint-disable-next-line scss/selector-no-redundant-nesting-selector
& > span {
outline: map-get($border-widths, 3) solid $brand-orange;
outline-offset: $outline-offset;
box-shadow: 0 0 0 $outline-offset $white;
> span {
@include focus-visible();
}
}
}
// scss-docs-end focus-visible-carousel
// End mod
}

Expand Down Expand Up @@ -228,9 +228,6 @@

louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
&:focus {
&[data-focus-visible-added] {
outline: map-get($border-widths, 3) solid $brand-orange;
outline-offset: $outline-offset;
box-shadow: 0 0 0 $outline-offset $white;
transform: none;
}
}
Expand Down
18 changes: 1 addition & 17 deletions scss/_close.scss
Expand Up @@ -20,7 +20,6 @@
color: var(--#{$prefix}btn-close-color); // Boosted mod
background-color: var(--#{$prefix}btn-close-bg); // Boosted mod
border: var(--#{$prefix}btn-close-border-width) solid var(--#{$prefix}btn-close-border-color); // Boosted mod
outline-offset: map-get($spacers, 2); // Boosted mod
@include border-radius();
@include button-icon($btn-close-bg, $btn-close-width, $btn-close-height, $btn-close-icon-size); // Boosted mod: using mask instead of background

Expand All @@ -32,20 +31,10 @@

// Boosted mod: matching .btn-no-outline
&:hover,
&:focus,
&:active {
border: var(--#{$prefix}btn-close-border-width) solid var(--#{$prefix}btn-close-active-border-color);
}

&:focus {
outline-offset: $outline-width;
@include transition($transition-focus);

&[data-focus-visible-added] {
box-shadow: $btn-close-focus-shadow;
}
}

&:active {
color: var(--#{$prefix}btn-close-active-color);
}
Expand All @@ -56,6 +45,7 @@
color: var(--#{$prefix}btn-close-disabled-color); // Boosted mod
pointer-events: none;
user-select: none;
// Boosted mod: no opacity
}
}

Expand All @@ -70,11 +60,5 @@
--#{$prefix}btn-close-active-border-color: #{$btn-close-white-active-border-color}; // Boosted mod
--#{$prefix}btn-close-disabled-color: #{$btn-close-white-disabled-color}; // Boosted mod
// scss-docs-end btn-close-white-css-vars

&:focus {
&[data-focus-visible-added] {
box-shadow: 0 0 0 $btn-focus-width $black;
}
}
}
// End mod
19 changes: 16 additions & 3 deletions scss/_dropdown.scss
Expand Up @@ -194,11 +194,10 @@
background-color: transparent; // For `<button>`s
border: 0; // For `<button>`s

&:hover,
&:focus {
// Boosted mod: no focus
&:hover {
color: var(--#{$prefix}dropdown-link-hover-color);
text-decoration: if($link-hover-decoration == underline, none, null);
outline-color: var(--#{$prefix}dropdown-link-hover-bg); // Boosted mod
@include gradient-bg(var(--#{$prefix}dropdown-link-hover-bg));
}

Expand All @@ -217,6 +216,20 @@
// Remove CSS gradients if they're enabled
background-image: if($enable-gradients, none, null);
}

// Boosted mod: focus
&:focus {
&[data-focus-visible-added] {
outline-offset: -$focus-visible-outer-width;
box-shadow: inset 0 0 0 add($focus-visible-inner-width, $focus-visible-outer-width) var(--#{$prefix}focus-visible-inner-color);

&.active {
outline-color: var(--#{$prefix}focus-visible-inner-color);
box-shadow: inset 0 0 0 add($focus-visible-inner-width, $focus-visible-outer-width) var(--#{$prefix}focus-visible-outer-color);
}
}
}
// End mod
}

.dropdown-menu.show {
Expand Down
2 changes: 1 addition & 1 deletion scss/_footer.scss
Expand Up @@ -26,7 +26,7 @@
gap: var(--#{$prefix}footer-gap);

.nav-link {
outline-offset: 5px;
MewenLeHo marked this conversation as resolved.
Show resolved Hide resolved
outline-offset: $focus-visible-outer-offset; // Override outline offset coming from .navbar-nav

&.active::before {
content: unset;
Expand Down
23 changes: 17 additions & 6 deletions scss/_list-group.scss
Expand Up @@ -52,17 +52,13 @@
width: 100%; // For `<button>`s (anchors become 100% by default though)
color: var(--#{$prefix}list-group-action-color);
text-align: inherit; // For `<button>`s (anchors inherit)
outline-offset: $spacer; // Boosted mod
@include transition($transition-focus); // Boosted mod

// Boosted mod: default focus
// Hover state
&:hover,
&:focus {
&:hover{
z-index: 1; // Place hover/focus items above their siblings for proper border styling
color: var(--#{$prefix}list-group-action-hover-color);
text-decoration: none;
outline-color: var(--#{$prefix}list-group-action-color); // Boosted mod
outline-offset: var(--#{$prefix}list-group-border-width); // Boosted mod
// Boosted mod: no background change
}

Expand All @@ -85,6 +81,7 @@
text-decoration: if($link-decoration == none, null, none);
background-color: var(--#{$prefix}list-group-bg);
border: var(--#{$prefix}list-group-border-width) solid var(--#{$prefix}list-group-border-color);
box-shadow: none; // Boosted mod

&:first-child {
@include border-top-radius(inherit);
Expand Down Expand Up @@ -118,6 +115,20 @@
border-top-width: var(--#{$prefix}list-group-border-width);
}
}

// Boosted mod: focus
&:focus {
&[data-focus-visible-added] {
outline-offset: subtract(-$focus-visible-outer-width, var(--#{$prefix}list-group-border-width));
box-shadow: inset 0 0 0 add($focus-visible-inner-width, $focus-visible-outer-width) var(--#{$prefix}focus-visible-inner-color);

&.active {
outline-color: var(--#{$prefix}focus-visible-inner-color);
box-shadow: inset 0 0 0 add($focus-visible-inner-width, $focus-visible-outer-width) var(--#{$prefix}focus-visible-outer-color);
}
}
}
// End mod
}

// Horizontal
Expand Down
1 change: 1 addition & 0 deletions scss/_mixins.scss
Expand Up @@ -38,6 +38,7 @@
@import "mixins/box-shadow";
@import "mixins/gradients";
@import "mixins/transition";
@import "mixins/focus"; // Boosted mod

// Layout
@import "mixins/clearfix";
Expand Down