mirror of
https://github.com/primer/css.git
synced 2024-11-22 10:49:41 +03:00
Prevent .show-on-focus
to change width/height (#2391)
* Update `.show-on-focus` to not reset width/height * Add `ShowOnFocus` story * Create .changeset/shy-pumpkins-walk.md
This commit is contained in:
parent
5dc4feadff
commit
95ab0d0f48
5
.changeset/shy-pumpkins-walk.md
Normal file
5
.changeset/shy-pumpkins-walk.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@primer/css": patch
|
||||
---
|
||||
|
||||
Prevent `.show-on-focus` to change width/height
|
@ -285,6 +285,13 @@ export const ScreenReaderOnly = ({}) => (
|
||||
</div>
|
||||
)
|
||||
|
||||
export const ShowOnFocus = ({}) => (
|
||||
<div>
|
||||
<div class="mb-2">Click here and press tab to make the ".show-on-focus" element appear</div>
|
||||
<button type="button" class="btn show-on-focus">.show-on-focus</button>
|
||||
</div>
|
||||
)
|
||||
|
||||
export const MediaObject = ({}) => (
|
||||
<div class="clearfix p-3 border">
|
||||
<div class="float-left p-3 mr-3 color-bg-subtle">
|
||||
|
@ -107,17 +107,18 @@
|
||||
|
||||
// Only display content on focus
|
||||
.show-on-focus {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
position: absolute !important;
|
||||
|
||||
&:not(:focus) {
|
||||
width: 1px !important;
|
||||
height: 1px !important;
|
||||
padding: 0 !important;
|
||||
overflow: hidden !important;
|
||||
clip: rect(1px, 1px, 1px, 1px) !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
z-index: 999;
|
||||
width: auto;
|
||||
height: auto;
|
||||
clip: auto;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user