Skip to content

Commit d525908

Browse files
authored
Merge 8b901c0 into cc84a12
2 parents cc84a12 + 8b901c0 commit d525908

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

.changeset/tabs-passive-scroll.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@patternfly/elements": patch
3+
---
4+
5+
`<pf-tabs>`: scroll event listeners are now passive for better performance.

elements/pf-tabs/pf-tabs.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { html, LitElement, type TemplateResult } from 'lit';
22
import { customElement } from 'lit/decorators/custom-element.js';
3+
import { eventOptions } from 'lit/decorators/event-options.js';
34
import { property } from 'lit/decorators/property.js';
45
import { query } from 'lit/decorators/query.js';
56
import { provide } from '@lit/context';
@@ -180,7 +181,7 @@ export class PfTabs extends LitElement {
180181
<!-- tablist -->
181182
<div id="tabs" part="tabs" role="tablist">
182183
<!-- Must contain one or more \`<pf-tab>\` -->
183-
<slot name="tab" @slotchange="${this.#onSlotChange}" @scroll="${this.#overflow.onScroll}"></slot>
184+
<slot name="tab" @slotchange="${this.#onSlotChange}" @scroll="${this.onScroll}"></slot>
184185
</div>
185186
${!this.#overflow.showScrollButtons ? '' : html`
186187
<button id="nextTab" tabindex="-1"
@@ -201,6 +202,11 @@ export class PfTabs extends LitElement {
201202
`;
202203
}
203204

205+
@eventOptions({ passive: true })
206+
private onScroll() {
207+
this.#overflow.onScroll();
208+
}
209+
204210
#scrollLeft() {
205211
this.#overflow.scrollLeft();
206212
}

0 commit comments

Comments
 (0)