backport 1787

This commit is contained in:
Cory LaViska
2023-12-13 12:04:53 -05:00
parent eb9dbf097c
commit fc9151e573
3 changed files with 16 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ New versions of Web Awesome are released as-needed and generally occur when a cr
- Added the `hover-bridge` feature to `<sl-popup>` to support better tooltip accessibility [#1734]
- Fixed a bug in `<sl-input>` and `<sl-textarea>` that made it work differently from `<input>` and `<textarea>` when using defaults [#1746]
- Fixed a bug in `<sl-select>` that prevented it from closing when tabbing to another select inside a shadow root [#1763]
- Fixed a bug in `<sl-spinner>` that caused the animation to appear strange in certain circumstances [#1787]
- Improved the accessibility of `<sl-tooltip>` so they persist when hovering over the tooltip and dismiss when pressing [[Esc]] [#1734]
## 2.12.0

View File

@@ -1,6 +1,11 @@
import { css } from 'lit';
import componentStyles from '../../styles/component.styles.js';
// Resizing a spinner element using anything but font-size will break the animation because the animation uses em units.
// Therefore, if a spinner is used in a flex container without `flex: none` applied, the spinner can grow/shrink and
// break the animation. The use of `flex: none` on the host element prevents this by always having the spinner sized
// according to its actual dimensions.
export default css`
${componentStyles}
@@ -13,6 +18,7 @@ export default css`
display: inline-flex;
width: 1em;
height: 1em;
flex: none;
}
.spinner {
@@ -46,7 +52,7 @@ export default css`
@keyframes spin {
0% {
transform: rotate(0deg);
stroke-dasharray: 0.01em, 2.75em;
stroke-dasharray: 0.05em, 3em;
}
50% {
@@ -56,7 +62,7 @@ export default css`
100% {
transform: rotate(1080deg);
stroke-dasharray: 0.01em, 2.75em;
stroke-dasharray: 0.05em, 3em;
}
}
`;

View File

@@ -27,5 +27,12 @@ describe('<wa-spinner>', () => {
//
expect(getComputedStyle(indicator).transform).to.equal('matrix(1, 0, 0, 1, 0, 0)');
});
it('should have flex:none to prevent flex re-sizing', async () => {
const spinner = await fixture<WaSpinner>(html` <wa-spinner></wa-spinner> `);
// 0 0 auto is a compiled value for `none`
expect(getComputedStyle(spinner).flex).to.equal('0 0 auto');
});
});
});