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

v4: Add interaction utils #30562

Merged
merged 2 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scss/_reboot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ select {
text-transform: none; // Remove the inheritance of text transform in Firefox
}

// Set the cursor for non-`<button>` buttons
//
// Details at https://github.com/twbs/bootstrap/pull/30562
[role="button"] {
cursor: pointer;
}

// Remove the inheritance of word-wrap in Safari.
//
// Details at https://github.com/twbs/bootstrap/issues/24990
Expand Down
1 change: 1 addition & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,7 @@ $pre-scrollable-max-height: 340px !default;
$displays: none, inline, inline-block, block, table, table-row, table-cell, flex, inline-flex !default;
$overflows: auto, hidden !default;
$positions: static, relative, absolute, fixed, sticky !default;
$user-selects: all, auto, none !default;


// Printing
Expand Down
5 changes: 5 additions & 0 deletions scss/utilities/_interactions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// stylelint-disable declaration-no-important

@each $value in $user-selects {
.user-select-#{$value} { user-select: $value !important; }
}
1 change: 1 addition & 0 deletions site/_data/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
- title: Flex
- title: Float
- title: Image replacement
- title: Interactions
- title: Overflow
- title: Position
- title: Screen readers
Expand Down
9 changes: 9 additions & 0 deletions site/docs/4.4/content/reboot.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ These changes, and more, are demonstrated below.
</fieldset>
</form>

### Pointers on buttons

Reboot includes an enhancement for `role="button"` to change the default cursor to `pointer`. Add this attribute to elements to help indicate elements are interactive. This role isn't necessary for `<button>` elements, which gets it's own `cursor` change.

{% capture example %}
<span role="button">Non-button element button</span>
{% endcapture %}
{% include example.html content=example %}

## Misc elements

### Address
Expand Down
19 changes: 19 additions & 0 deletions site/docs/4.4/utilities/interactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: docs
title: Interactions
description: Utility classes that change how users interact with contents of a website.
group: utilities
---

## Text selection

Change the way in which the content is selected when the user interacts with it.

{% capture example %}
<p class="user-select-all">This paragraph will be entirely selected when clicked by the user.</p>
<p class="user-select-auto">This paragraph has the default select behavior.</p>
<p class="user-select-none">This paragraph will not be selectable when clicked by the user.</p>
{% endcapture %}
{% include example.html content=example %}

Customize the available classes by changing the `$user-selects` Sass list in `_variables.scss`.