Skip to content

Commit 836d06d

Browse files
Mention pointer-events usage
1 parent ae13103 commit 836d06d

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

scss/mixins/_buttons.scss

+17-18
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@
2828
}
2929
}
3030

31-
// Disabled comes first so active can properly restyle
32-
&.disabled,
33-
&:disabled {
34-
color: color-yiq($background);
35-
background-color: $background;
36-
border-color: $border;
37-
// Remove CSS gradients if they're enabled
38-
@if $enable-gradients {
39-
background-image: none;
40-
}
41-
}
42-
4331
&:active,
4432
&.active,
4533
.show > &.dropdown-toggle {
@@ -59,6 +47,17 @@
5947
}
6048
}
6149
}
50+
51+
&.disabled,
52+
&:disabled {
53+
color: color-yiq($background);
54+
background-color: $background;
55+
border-color: $border;
56+
// Remove CSS gradients if they're enabled
57+
@if $enable-gradients {
58+
background-image: none;
59+
}
60+
}
6261
}
6362

6463
@mixin button-outline-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) {
@@ -76,12 +75,6 @@
7675
box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
7776
}
7877

79-
&.disabled,
80-
&:disabled {
81-
color: $color;
82-
background-color: transparent;
83-
}
84-
8578
&:active,
8679
&.active,
8780
.show > &.dropdown-toggle {
@@ -98,6 +91,12 @@
9891
}
9992
}
10093
}
94+
95+
&.disabled,
96+
&:disabled {
97+
color: $color;
98+
background-color: transparent;
99+
}
101100
}
102101

103102
// Button sizes

site/content/docs/4.3/components/buttons.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Buttons will appear pressed (with a darker background, darker border, and inset
8282

8383
## Disabled state
8484

85-
Make buttons look inactive by adding the `disabled` boolean attribute to any `<button>` element.
85+
Make buttons look inactive by adding the `disabled` boolean attribute to any `<button>` element. Disabled buttons have `pointer-events: none` applied to, preventing hover and active states from triggering.
8686

8787
{{< example >}}
8888
<button type="button" class="btn btn-lg btn-primary" disabled>Primary button</button>

site/content/docs/4.3/components/close-icon.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ description: Use a generic close icon for dismissing content like modals and ale
55
group: components
66
---
77

8-
**Be sure to include text for screen readers**, as we've done with `aria-label`.
8+
**Be sure to include text for screen readers**, as we've done with `aria-label`. Disabled close buttons have `pointer-events: none` applied to, preventing hover and active states from triggering.
99

1010
{{< example >}}
1111
<button type="button" class="close" aria-label="Close">
1212
<span aria-hidden="true">&times;</span>
1313
</button>
14+
15+
<button type="button" class="close" disabled aria-label="Close">
16+
<span aria-hidden="true">&times;</span>
17+
</button>
1418
{{< /example >}}

site/content/docs/4.3/migration.md

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ Changes to Reboot, typography, tables, and more.
8686

8787
## Components
8888

89+
### Disabled states
90+
91+
- Disabled states of the buttons, close button, pagination link & form range now have `pointer-events: none` added. This simplifies our codebase and makes it easier to override active states in CSS. [#29296](https://github.com/twbs/bootstrap/pull/29296).
92+
8993
### Alerts
9094

9195
- **Todo:** Remove auto-darkening of `<hr>` elements in `.alert-*` class variants. `<hr>`s use `rgba()` for their color, so these should naturally blend anyway.

0 commit comments

Comments
 (0)