@brightspace-ui/core 2.154.2 → 2.155.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,16 @@
29
29
  </template>
30
30
  </d2l-demo-snippet>
31
31
 
32
+ <h2>Web Component Using Styles - Forced LTR Container</h2>
33
+ <d2l-demo-snippet>
34
+ <template>
35
+ <span dir="ltr">
36
+ <p>Some off-screen content:</p>
37
+ <d2l-offscreen-demo></d2l-offscreen-demo>
38
+ </span>
39
+ </template>
40
+ </d2l-demo-snippet>
41
+
32
42
  </d2l-demo-page>
33
43
  </body>
34
44
  </html>
@@ -1,19 +1,20 @@
1
1
  import { css, html, LitElement } from 'lit';
2
2
  import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
3
3
 
4
- export const offscreenStyles = css`
5
- .d2l-offscreen {
4
+ const offscreenStyleDeclarations = css`
5
+ direction: var(--d2l-document-direction, ${document.dir === 'rtl' ? css`rtl` : css`ltr`});
6
6
  height: 1px;
7
7
  inset-inline-start: -10000px;
8
- left: -10000px;
8
+ ${document.dir === 'rtl' ? css`right` : css`left`}: -10000px;
9
9
  overflow: hidden;
10
10
  position: absolute !important;
11
11
  white-space: nowrap;
12
12
  width: 1px;
13
- }
14
- :host([dir="rtl"]) .d2l-offscreen {
15
- left: 0;
16
- right: -10000px;
13
+ `;
14
+
15
+ export const offscreenStyles = css`
16
+ .d2l-offscreen {
17
+ ${offscreenStyleDeclarations}
17
18
  }
18
19
  `;
19
20
 
@@ -25,17 +26,7 @@ class Offscreen extends RtlMixin(LitElement) {
25
26
  static get styles() {
26
27
  return css`
27
28
  :host {
28
- height: 1px;
29
- inset-inline-start: -10000px;
30
- left: -10000px;
31
- overflow: hidden;
32
- position: absolute !important;
33
- white-space: nowrap;
34
- width: 1px;
35
- }
36
- :host([dir="rtl"]) {
37
- left: 0;
38
- right: -10000px;
29
+ ${offscreenStyleDeclarations}
39
30
  }
40
31
  `;
41
32
  }
@@ -407,12 +407,16 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
407
407
 
408
408
  if (!this.shadowRoot) return;
409
409
 
410
+ const isMoreButton = e.target.classList.contains('d2l-tag-list-button-show-more');
410
411
  await this.updateComplete;
411
- if (e.target.classList.contains('d2l-tag-list-button-show-more')) this._items[this._chompIndex].focus();
412
- else {
413
- const button = this.shadowRoot.querySelector('.d2l-tag-list-button');
414
- if (button) button.focus();
412
+ await new Promise((r) => setTimeout(r, 100)); // wait for items to appear before focusing
413
+ if (isMoreButton) {
414
+ this._items[this._chompIndex].focus();
415
+ } else {
416
+ this.shadowRoot.querySelector('.d2l-tag-list-button')?.focus();
415
417
  }
418
+ /** @ignore */
419
+ this.dispatchEvent(new CustomEvent('d2l-tag-list-focus', { bubbles: false, composed: false }));
416
420
  }
417
421
  }
418
422
 
@@ -10,6 +10,14 @@ if (!document.head.querySelector('#d2l-typography-font-face')) {
10
10
  const style = document.createElement('style');
11
11
  style.id = 'd2l-typography-font-face';
12
12
  style.textContent = `
13
+ * {
14
+ --d2l-document-direction: ltr;
15
+ }
16
+
17
+ html[dir="rtl"] * {
18
+ --d2l-document-direction: rtl;
19
+ }
20
+
13
21
  @font-face {
14
22
  font-family: 'Lato';
15
23
  font-style: normal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.154.2",
3
+ "version": "2.155.1",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",