pull/2101/head
Cory LaViska 2024-06-21 13:36:06 -04:00
commit e142132b78
3 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti
- `<sl-tab>` `closable` property now reflects. [#2041]
- `<sl-tab-group>` now implements a proper "roving tabindex" and `<sl-tab>` is no longer tabbable by default. This aligns closer to the APG pattern for tabs. [#2041]
- Fixed a bug in the submenu controller that prevented submenus from rendering in RTL without explicitly setting `dir` on the parent menu item [#1992]
- When calling `customElements.define` we no longer register with anonymous classes by default [#2079]
## 2.15.1

Wyświetl plik

@ -34,7 +34,8 @@ import type SlMenu from '../menu/menu.js';
* @event sl-hide - Emitted when the dropdown closes.
* @event sl-after-hide - Emitted after the dropdown closes and all animations are complete.
*
* @csspart base - The component's base wrapper.
* @csspart base - The component's base wrapper, an `<sl-popup>` element.
* @csspart base__popup - The popup's exported `popup` part. Use this to target the tooltip's popup container.
* @csspart trigger - The container that wraps the trigger.
* @csspart panel - The panel that gets shown when the dropdown is open.
*
@ -406,6 +407,7 @@ export default class SlDropdown extends ShoelaceElement {
return html`
<sl-popup
part="base"
exportparts="popup:base__popup"
id="dropdown"
placement=${this.placement}
distance=${this.distance}

Wyświetl plik

@ -104,7 +104,15 @@ export default class ShoelaceElement extends LitElement {
| typeof ShoelaceElement;
if (!currentlyRegisteredConstructor) {
customElements.define(name, class extends elementConstructor {} as unknown as CustomElementConstructor, options);
// We try to register as the actual class first. If for some reason that fails, we fall back to anonymous classes.
// customElements can only have 1 class of the same "object id" per registry, so that is why the try {} catch {} exists.
// Some tools like Jest Snapshots and if you import the constructor and call `new SlButton()` they will fail with
// the anonymous class version.
try {
customElements.define(name, elementConstructor, options);
} catch (_err) {
customElements.define(name, class extends elementConstructor {}, options);
}
return;
}