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

Regular readonly input #33929

Closed
wants to merge 2 commits into from
Closed
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
13 changes: 6 additions & 7 deletions scss/forms/_form-control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
&[type="file"] {
overflow: hidden; // prevent pseudo element button overlap

&:not(:disabled):not(:read-only) {
&:not(:disabled) {
cursor: pointer;
}
}
Expand Down Expand Up @@ -59,13 +59,12 @@
opacity: 1;
}

// Disabled and read-only inputs
// Disabled inputs
//
// HTML5 says that controls under a fieldset > legend:first-child won't be
// disabled if the fieldset is disabled. Due to implementation difficulty, we
// don't honor that edge case; we style them as disabled anyway.
&:disabled,
&:read-only {
&:disabled {
background-color: $input-disabled-bg;
border-color: $input-disabled-border-color;
// iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
Expand All @@ -88,7 +87,7 @@
@include transition($btn-transition);
}

&:hover:not(:disabled):not(:read-only)::file-selector-button {
&:hover:not(:disabled)::file-selector-button {
background-color: $form-file-button-hover-bg;
}

Expand All @@ -107,7 +106,7 @@
@include transition($btn-transition);
}

&:hover:not(:disabled):not(:read-only)::-webkit-file-upload-button {
&:hover:not(:disabled)::-webkit-file-upload-button {
background-color: $form-file-button-hover-bg;
}
}
Expand Down Expand Up @@ -203,7 +202,7 @@ textarea {
height: auto; // Override fixed browser height
padding: $input-padding-y;

&:not(:disabled):not(:read-only) {
&:not(:disabled) {
cursor: pointer;
}

Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/5.0/forms/form-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Add the `disabled` boolean attribute on an input to give it a grayed out appeara

## Readonly

Add the `readonly` boolean attribute on an input to prevent modification of the input's value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor.
Add the `readonly` boolean attribute on an input to prevent modification of the input's value.

{{< example >}}
<input class="form-control" type="text" placeholder="Readonly input here..." aria-label="readonly input example" readonly>
Expand Down