-
ca65338:
ScrollSpyController: fix race conditions on rapid and smooth scroll navigation- Fix rapid clicks leaving stale force-release listeners that caused the active state to fall "one click behind"
- Release force on
scrollendinstead of first IntersectionObserver callback, preventing intermediate sections from stealing active state during smooth scroll - Sort passed links by DOM order instead of Set insertion order, fixing incorrect active state with non-contiguous content sections
-
ec6b358:
ATFocusController: fix keyboard focus wrapping and dynamic item support- Fix arrow up/down focus wrapping when a non-focusable placeholder occupies index 0 (e.g. a disabled "Select a value" option)
- Fix dynamically added options not receiving keyboard focus until the listbox is reopened
- a13e259: Update dependencies
- 788a567:
FloatingDOMController: improved performance by inling and removing the@floating-ui/domdependency
- 2cf37ca:
InternalsController: addariaRelevantproperty
- ce5b27b:
SlotController: correctly report the state of the default slot inisEmpty()calls with no arguments
- fefd8bb:
SlotController: correctly report slot content after updating
-
0277045: Enable
connectedCallback()and context protocol in SSR scenarios.BREAKING CHANGE This change affects any element which is expected to execute in node JS when lit-ssr shims are present. By enabling the
connectedCallback()to execute server side. Elements must ensure that their connectedCallbacks do not try to access the DOM.Before:
connectedCallback() { super.connectedCallback(); this.items = [...this.querySelectorAll('my-item')]; }
After:
connectedCallback() { super.connectedCallback(); if (!isServer) { this.items = isServer ? [] : [...this.querySelectorAll('my-item')]; } }
-
8b5b699: SSR: added
ssr-hint-has-slottedandssr-hint-has-slotted-defaultattributes to elements that use slot controller.When running SSR on elements with slots, add these attributes to ensure they render correctly.
<pf-card ssr-hint-has-slotted-default ssr-hint-has-slotted="header,footer"> <h2 slot="header">Header Content</h2> <p>Default content</p> <span slot="footer">Footer Content</span> </pf-card>
- a2f3254:
ScrollSpyController: respond to hashchange events
- 0fb28b6:
SlotController:hasContent/isEmptynow respects text nodes
- 4a03ced: SSR: add shim for
ResizeObserver
- 7c855a6:
TabsARIAController: improve SSR compatibility
- 0ec7338:
OverflowController: prevent browser from locking up in some scenarios
- 43b97bf:
InternalsController: prevent Safari-detector from breaking SSR
-
c9bd577:
RovingTabindexController,ListboxController: constructor options were changed. In particular, theinitItems(items: Item[])andsetActiveItem(item: Item)methods were removed and replaced with thegetItems: () => Item[]constructor option, and theatFocusedItemIndexaccessor.Before:
#tabindex = new RovingTabindexController(this); firstUpdated() { this.#tabindex.initItems(this.items); } updated(changed: PropertyValues<this>) { if (changed.has('activeItem')) { this.#tabindex.setActiveItem(this.activeItem); } }
After:
#tabindex = RovingTabindexController.of(this, { getItems: () => this.items, }); updated(changed: PropertyValues<this>) { if (changed.has('activeItem')) { this.#tabindex.atFocusedItemIndex = this.items.indexOf(this.activeItem); } }
For further migration guidance, please see the sources in
@patternfly/pfe-core, especially:ATFocusController.ts,RovingTabindexController.ts, andListboxController.ts.
-
c9bd577: Removed global
pfeLogfeature -
c9bd577: Removed
window.PfeConfigglobal config object -
c9bd577: Removed global
auto-revealfeature -
c9bd577: Decorators: Added
@observes. Use it to add property change callback by decorating them with the name of the property to observe@customElement("custom-button") class CustomButton extends LitElement { #internals = this.attachInternals(); @property({ type: Boolean }) disabled = false; @observes("disabled") protected disabledChanged() { this.#internals.ariaDisabled = this.disabled ? "true" : this.ariaDisabled ?? "false"; } }
Breaking change: This commit makes some changes to the internal APIs of the pre-existing
@observedobserver, most notably it changes the constructor signature of thePropertyObserverControllerand associated functions. Most users should not have to make any changes, but if you directly import and use those functions, check the commit log to see how to update your call sites. -
c9bd577: Removed global
trackPerformancefeature
-
c9bd577: ✨ Added
ActiveDescendantControllerThis controller implements the WAI-ARIA activedescendant pattern for keyboard and screen-reader accessibility.
#activedescendant = ActivedescendantController.of(this, { getItems: () => this.options, getItemsContainer: () => this.#listbox, getOrientation: () => "vertical", getActiveDescendantContainer: () => this.#input, getControlsElements: () => [this.#input, this.#button].filter((x) => !!x), setItemActive: (item, active) => void (item.active = active), });
-
c9bd577: ✨ Added
ComboboxControllerThis controller implements the WAI-ARIA combobox pattern for both select-only and inline autocomplete comboboxes.
#combobox = ComboboxController.of(this, { multi: this.multi, getItems: () => this.options, getFallbackLabel: () => this.accessibleLabel, getListboxElement: () => this._listbox ?? null, getToggleButton: () => this._toggleButton ?? null, getComboboxInput: () => this._toggleInput ?? null, isExpanded: () => this.expanded, requestShowListbox: () => void (this.expanded ||= true), requestHideListbox: () => void (this.expanded &&= false), setItemHidden: (item, hidden) => void (item.hidden = hidden), isItem: (item) => item instanceof PfOption, setItemActive: (item, active) => (item.active = active), setItemSelected: (item, selected) => (item.selected = selected), });
-
6d9045e:
InternalsController: added staticisSafariboolean flag -
c9bd577: Decorators: Added
@listen. Use it to attach element event listeners to class methods.@customElement("custom-input") class CustomInput extends LitElement { @property({ type: Boolean }) dirty = false; @listen("keyup", { once: true }) protected onKeyup() { this.dirty = true; } }
- c9bd577: updated dependencies
- c9bd577:
InternalsController: corrected the types for aria IDL list attributes - c9bd577: Context:
makeContextRootno longer crashes SSR processes
-
1d89f73:
RovingTabindexController: deprecate theinitItemsmethod and addgetItemsandgetItemContainerinsteadBEFORE:
#tabindex = new RovingTabindexController(this); constructor() { super(); this.#tabindex.initItems(this.#items); }
AFTER:
#tabindex = new RovingTabindexController(this, { getItems: () => this.#items, });
-
3766961:
@cascades: deprecated@cascadesdecorator andCascadeController. Use context instead.BEFORE: The element in charge of the context cascades data down to specifically named children.
import { LitElement } from "lit"; import { property } from "lit/decorators/property.js"; import { cascades } from "@patternfly/pfe-core/decorators/cascades.js"; class MyMood extends LitElement { @cascades("my-eyes", "my-mouth") @property() mood: "happy" | "sad" | "mad" | "glad"; }
AFTER: children subscribe to updates from the context provider.
import { LitElement } from "lit"; import { property } from "lit/decorators/property.js"; import { provide } from "@lit/context"; import { createContextWithRoot } from "@patternfly/pfe-core/functions/context.js"; export type Mood = "happy" | "sad" | "mad" | "glad"; export const moodContext = createContextWithRoot<Mood>(Symbol("mood")); class MyMood extends LitElement { @provide({ context: moodContext }) @property() mood: Mood; }
import { LitElement } from "lit"; import { property } from "lit/decorators/property.js"; import { consume } from "@lit/context"; import { moodContext, type Mood } from "./my-mood.js"; class MyEyes extends LitElement { @consume({ context: moodContext, subscribe: true }) @state() private mood: Mood; }
-
0d92145:
InternalsController: made the constructor private. UseInternalsController.ofBEFORE:
class PfJazzHands extends LitElement { #internals = new InternalsController(this); }
AFTER:
class PfJazzHands extends LitElement { #internals = InternalsController.of(this); }
-
de4cfa4: Remove
deprecatedCustomEvent
-
ac0c376:
SlotController: AddisEmptymethod to check if a slot is empty. If no slot name is provided it will check the default slot. (#2603)SlotController:hasSlottedmethod now returns default slot if no slot name is provided. (#2603) -
d4e5411: Context: added
createContextWithRoot. Use this when creating contexts that are shared with child elements. -
c71bbe5:
InternalsController: addedcomputedLabelTextread-only property -
c71bbe5:
InternalsController: reflect all methods and properties fromElementInternals -
fa50164:
Logger: loosen the type of allowed controller hosts -
fa50164:
OverflowController: recalculate overflow when the window size changes and when tabs are dynamically created. -
0d92145:
RovingTabindexController: keyboard navigation includes first-character navigation. -
fa50164:
TabsAriaController: Added TabsAriaController, used to manage the accesibility tree for tabs and panels.#tabs = new TabsAriaController(this, { isTab: (x: Node): x is PfTab => x instanceof PfTab, isPanel: (x: Node): x is PfTabPanel => x instanceof PfTabPanel, });
Please review the Tabs 2.4 to 3.0 migration guide for more information.
- 24d43bd:
Logger: addLogger.infoandLogger.debug - e62244f:
InternalsController: added missingariaDescriptiondefined by ARIAMixin - 24d43bd:
SlotController: move debug logs toLogger.debug - 50f462c: Update dependencies, including Lit version 3
- 5b16b3b04:
SlotController: ensure first render is correct when used in certain javascript frameworks
- a81bcb133: Controllers: Added timestamp controller
- 7055add74:
FloatingDOMController: fixed an incorrect typescript import
- c5d95880c: roving-tabindex-controller: fixes arrow keydown event listeners
- 78c8e4416: Added
StringListConverterfor managing comma-separated list attributes.
- 37c23c398:
overflow-controller:- improves display calculations for overflow scroll buttons
- adds smooth scroll behavior
- 83024fe5e:
roving-tabindex-controller: notify the host when the focused item changes. - 83024fe5e:
roving-tabindex-controller: allow component authors to specify the type of items.
- e45f5eb5a:
roving-tabindex-controller: enabled controller to be used by aria-expanded elements
-
e8788c7214: Initial Release 🎉
@patternfly/pfe-coreprovides utilities for building PatternFly elements, like TypeScript decorators and Lit reactive controllers. Core utilities replace thePFElementbase class.export class PfeJazzHands extends PFElement { static get tag() { return "pfe-jazz-hands"; } static get properties() { return { cool: { type: Boolean, observer: "_upgradeObserver", }, }; } } PFElement.create(PfeJazzHands);
@customElement("pf-jazz-hands") export class PfJazzHands extends LitElement { @observed("_upgradeObserver") @property({ type: Boolean }) cool = true; _upgradeObserver() { console.log("cool"); } }
-
✨ Added
FloatingDOMControllerfor use with components that require popover content. For example, inBaseTooltipwe use the controller in this manner:import { FloatingDOMController } from "@patternfly/pfe-core/controllers/floating-dom-controller.js"; export class BaseTooltip extends LitElement { #domController = new FloatingDOMController(this); }
-
✨ Added
InternalsController, providing preliminary facility for ElementInternals -
✨ Added
ScrollSpyControllerwhich sets an attribute (activeby default) on one of it's children when that child'shrefattribute is to a hash reference to an ID'd heading on the page. -
✨ Added
RovingTabindexControllerwhich implements roving tabindex, as described in WAI-ARIA practices. AddedRovingTabindexController.
See README and the docs for more info.
-
-
530ef7155: ✨ Added
OverflowControllerWhen added to a container and given a child array of elements,
OverflowControllerchecks to see if those elements exceed the bounds of the container. -
2e1fb5705:
InternalsController: addedlabelsandvaliditygetters; addedsetFormValue,setValidity,checkValidityandreportValiditymethods
- 5d3315fd4: Prepared release candidate
-
530ef7155: ✨ Added
OverflowControllerWhen added to a container and given a child array of elements,
OverflowControllerchecks to see if those elements exceed the bounds of the container. -
2e1fb5705:
InternalsController: addedlabelsandvaliditygetters; addedsetFormValue,setValidity,checkValidityandreportValiditymethods
- 5d3315fd: Prepared release candidate
-
82da44c11: ✨ Added
ScrollSpyController✨ AddedRovingTabindexControllerScrollSpyControllersets an attribute (activeby default) on one of it's children when that child'shrefattribute is to a hash reference to an IDd heading on the page.RovingTabindexControllerimplements roving tabindex, as described in WAI-ARIA practices.
-
b841afe40:
FloatingDOMController: Removedpopperjsdependency and replaced it withfloating-uidependency.- removed the
initializedproperty - removed the
createmethod - added
show(options)method withplacementandoffsetoptions. - added
arrow,flip,padding, andshiftoptions - added read-only
alignment,anchor,placement, andstylesproperties. - made
openproperty read-only.
Now,
FloatingDOMControllers constructor requires certain options, at leastcontent, which is anHTMLElementor a function returning anHTMLElement.Before:
class MyElement extends LitElement { #floating = new FloatingDOMController(this); }
After:
class MyElement extends LitElement { #floating = new FloatingDOMController(this, { content: () => this.shadowRoot.getElementById('content'); }); }
- removed the
-
0fe6c52db: Added options to
InternalsController. Use them to initializeARIAproperties.role: 'listbox', });
-
0fe6c52db:
InternalsController: hook into host'sformDisabledCallback
- 6b6e2617: Add InternalsController, providing preliminary facility for ElementInternals
-
b6bb3818: ### pfe-tabs: Rewrites
<pfe-tabs>to align with Patternfly v4.With this change we are adding base class components
BaseTabs,BaseTab, andBaseTabPanelwhich can be extended for uses in other components in child repositories such as RHDS. Also aligns the API and style closer to that of PatternFly v4.<pfe-tabs> <pfe-tab slot="tab" id="users">Users</pfe-tab> <pfe-tab-panel>Users</pfe-tab-panel> <pfe-tab slot="tab">Containers</pfe-tab> <pfe-tab-panel>Containers <a href="#">Focusable element</a></pfe-tab-panel> <pfe-tab slot="tab">Database</pfe-tab> <pfe-tab-panel> <pfe-icon slot="icon" icon="rh-atom"></pfe-icon> <!-- <pfe-icon> or <svg> --> Database </pfe-tab-panel> <pfe-tab slot="tab" disabled>Disabled</pfe-tab> <pfe-tab-panel>Disabled</pfe-tab-panel> <pfe-tab slot="tab" aria-disabled="true">Aria Disabled</pfe-tab> <pfe-tab-panel>Aria Disabled</pfe-tab-panel> </pfe-tabs>
For now, does not implement:
- sub tabs feature
- nav element feature
- separate content (trigger) feature
- child tab-panel mounting features
- dynamic closable tabs feature
- loading a tab via external toggle
These feature sets can be added retroactively.
The
isElementInViewfunction is borrowed from the Patternfly React core helper utilities.
- 07ad1d3d: Updates use of
<pfe-icon>
- 166ecee1: Improves performance of floating DOM (tooltip) by lazily initializing
- bfad8b4b: Updates dependencies
-
7c9b85cc: Adds floating DOM controller into pfe-core for use with components that require popover content.
For example, in
BaseTooltipwe use the controller in this manner:import { FloatingDOMController } from "@patternfly/pfe-core/controllers/floating-dom-controller.js"; export class BaseTooltip extends LitElement { #domController = new FloatingDOMController(this); }
- 34ecd410:
SlotControllernow correctly initializes when given a single string slot name as config argument
- 55e843c8: - If
onattribute is set in HTML, it overrides color context from providers
- 6a2a0407: View commit message here
- 447b2d75: Remove
esbuildexport condition, as this anyways was a runtime error
- c84a4366: Explicitly adds each module to the export map
- 999cdfdd: Register context providers even if they upgrade after the consumers
-
e8788c72: Initial Release 🎉
@patternfly/pfe-coreprovides utilities for building PatternFly elements, like TypeScript decorators and Lit reactive controllers. Core utilities replace thePFElementbase class.export class PfeJazzHands extends PFElement { static get tag() { return "pfe-jazz-hands"; } static get properties() { return { cool: { type: Boolean, observer: "_upgradeObserver", }, }; } } PFElement.create(PfeJazzHands);
@customElement("pfe-jazz-hands") @pfelement() export class PfeJazzHands extends LitElement { static readonly version = "{{version}}"; @observed("_upgradeObserver") @property({ type: Boolean }) cool = true; }
See README and the docs for more info.