Skip to content

Commit acca6ef

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/2012-tooltip-support-aria-labelledby-for-anchoring-the-tooltip-to-its-owner
2 parents 7e8531d + 6e34fcb commit acca6ef

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

.changeset/afraid-adults-serve.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@sl-design-system/listbox': patch
3+
---
4+
5+
- Adds missing divider between groups and options,
6+
- Fixes rendering `sl-option-group-header` only when the label attribute is set.

packages/components/listbox/src/listbox.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,19 @@ export class Listbox<T = any, U = T> extends ScopedElementsMixin(LitElement) {
230230
#propagateEmphasis(): void {
231231
const slot = this.renderRoot.querySelector('slot');
232232

233+
// This is a workaround because we can't (yet) target combinations of ::slotted children using :has()
234+
const style = document.createElement('style');
235+
style.innerHTML = `
236+
sl-option-group:has(+ sl-option) {
237+
border-block-end: var(--sl-color-border-plain) solid var(--sl-size-borderWidth-default);
238+
margin-block-end: var(--sl-size-075);
239+
padding-block-end: var(--sl-size-100);
240+
}
241+
`;
242+
233243
slot?.assignedElements({ flatten: true }).forEach(el => {
244+
el.append(style);
245+
234246
if (el instanceof Option) {
235247
el.emphasis = this.emphasis;
236248
} else if (el instanceof OptionGroup) {

packages/components/listbox/src/option-group.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
2-
import { type CSSResultGroup, LitElement, type PropertyValues, type TemplateResult, html } from 'lit';
2+
import { type CSSResultGroup, LitElement, type PropertyValues, type TemplateResult, html, nothing } from 'lit';
33
import { property } from 'lit/decorators.js';
44
import { OptionGroupHeader } from './option-group-header.js';
55
import styles from './option-group.scss.js';
@@ -50,7 +50,7 @@ export class OptionGroup extends ScopedElementsMixin(LitElement) {
5050
override render(): TemplateResult {
5151
return html`
5252
<div part="wrapper">
53-
<sl-option-group-header>${this.label}</sl-option-group-header>
53+
${this.label ? html`<sl-option-group-header>${this.label}</sl-option-group-header>` : nothing}
5454
<slot></slot>
5555
</div>
5656
`;

packages/components/tabs/src/tab-group.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
transform-origin: center left;
193193
transition-property:
194194
width, height, translate; // TODO: `width` and `height` are not animated on the GPU, but `scale` is not working properly in Safari e.g. when zooming in/out (so we cannot use it right now). Change to `scale` when Safari supports it in a proper way.
195+
195196
transition-timing-function: ease-in-out;
196197
translate: 0;
197198

0 commit comments

Comments
 (0)