mirror of
https://github.com/shoelace-style/shoelace.git
synced 2026-01-12 02:59:13 +00:00
Merge branch 'next' of https://github.com/shoelace-style/shoelace into next
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user