@brightspace-ui/core 2.0.1 → 2.0.2

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.
@@ -12,14 +12,14 @@ If the elements are known up-front and are in the element's local DOM scope, sim
12
12
  import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys-mixin.js';
13
13
  class MyElement extends ArrowKeysMixin(LitElement) {
14
14
  render() {
15
- return html`
15
+ return this.arrowKeysContainer(html`
16
16
  <div>
17
17
  ...
18
18
  <a href="..." class="d2l-arrowkeys-focusable">link 1</a>
19
19
  <a href="..." class="d2l-arrowkeys-focusable">link 2</a>
20
20
  ...
21
21
  </div>
22
- `;
22
+ `);
23
23
  }
24
24
  }
25
25
  customElements.define('my-element', MyElement);
@@ -31,14 +31,14 @@ If the elements are not known up front, or the elements cannot be simply queried
31
31
  import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys-mixin.js';
32
32
  class MyElement extends ArrowKeysMixin(LitElement) {
33
33
  render() {
34
- return html`
34
+ return this.arrowKeysContainer(html`
35
35
  <div>
36
36
  ...
37
37
  <a href="...">link 1</a>
38
38
  <a href="...">link 2</a>
39
39
  ...
40
40
  </div>
41
- `;
41
+ `);
42
42
  }
43
43
  async arrowKeysFocusablesProvider() {
44
44
  return [ /* array containing focusable elements */]
@@ -51,4 +51,8 @@ customElements.define('my-element', MyElement);
51
51
 
52
52
  - `arrowKeysDirection` (String): Indicates which arrow keys are allowed (default is leftright)
53
53
  - `arrowKeysNoWrap` (Boolean): Whether focus should wrap from end-to-start and start-to-end
54
- - `arrowKeysBeforeFocus` (Function): Async callback invoked before focus us applied
54
+
55
+ **Methods:**
56
+ - `arrowKeysContainer(innerHtmlTemplate)`: Hooks up the event listener, to be used in your `render` function to wrap the focusable elements
57
+ - `async arrowKeysFocusablesProvider()` (Array): Optional - Override to provide the focusable elements if necessary (see above)
58
+ - `async arrowKeysOnBeforeFocus(elemToBeFocused)`: Optional - Override to provide an async callback invoked before focus is applied
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
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",