Skip to content

Commit 0ec7338

Browse files
fix(core): overflow controller resize loop (#2855)
* fix(core): add requestAnimation to resizeObserver on overflow controller * chore(core): add changeset * fix(core): replace checks, reduce overhead Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]> * chore(core): update changeset to correct change level Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]> * chore(core): update changeset language Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]> * test(tabs): add nextFrame to test given addtional requestAnimationFrame in overflow --------- Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
1 parent 366d21d commit 0ec7338

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@patternfly/pfe-core": patch
3+
---
4+
5+
`OverflowController`: prevent browser from locking up in some scenarios

core/pfe-core/controllers/overflow-controller.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ export class OverflowController implements ReactiveController {
4545
});
4646

4747
#ro = new ResizeObserver(() => {
48-
this.#setOverflowState();
48+
requestAnimationFrame(() => {
49+
this.#setOverflowState();
50+
});
4951
});
5052

5153
showScrollButtons = false;

elements/pf-tabs/test/pf-tabs.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,10 @@ describe('<pf-tabs>', function() {
199199
});
200200

201201
beforeEach(nextFrame);
202-
beforeEach(updateComplete);
202+
beforeEach(nextFrame);
203203
beforeEach(nextFrame);
204204
beforeEach(updateComplete);
205205

206-
207206
it('should have visible scroll buttons if overflowed', function() {
208207
// Note: overflow buttons are not included in the accessibility tree otherwise we'd test
209208
// for buttons there. tabindex="-1" is used on the buttons to prevent focus and was a

0 commit comments

Comments
 (0)