1.1.10 • Published 9 months ago

@blockquote-web-components/blockquote-directive-ariaidref-slot v1.1.10

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

blockquoteDirectiveAriaidrefSlot

Lit

This directive creates a slot element, hidden by default, with a specific name and id. The name and id of this slot should correspond to the 'slot' attribute of an element in the Light DOM. It connects the 'slot', 'name', and 'id' attributes of a slot to be used with ARIA relationships.

This slot element is used to overcome some limitations of the Shadow DOM.

aria attribute reflection

Demo

Open in StackBlitz

Usage

Light Dom:

<wrapper-dialog>
  <span slot="idref_">Registration - All fields are required</span>
</wrapper-dialog>

Shadow Dom:

class MyDialog extends LitElement {
  constructor() {
    super();
    this.labelledby = 'idref_';
  }

  get _labeledbyTpl() {
    return html`${this.labelledby ? blockquoteDirectiveAriaidrefSlot(this.labelledby) : ''}`;
  }

  render() {
    return html`
      <dialog aria-labelledby="${this.labelledby || nothing}"><slot></slot></dialog>
      // slot is hidden by default
      ${this._labeledbyTpl} // <slot name="idref_" id="idref_" hidden=""></slot>

      // slot not hidden
      ${this._labeledbyTpl, false} // <slot name="idref_" id="idref_"></slot>
    `;
  }
}

src/BlockquoteDirectiveAriaidrefSlot.js:

class: README

Variables

NameDescriptionType
blockquoteDirectiveAriaidrefSlot

Exports

KindNameDeclarationModulePackage
jsREADMEREADMEsrc/BlockquoteDirectiveAriaidrefSlot.js
jsblockquoteDirectiveAriaidrefSlotblockquoteDirectiveAriaidrefSlotsrc/BlockquoteDirectiveAriaidrefSlot.js

src/index.js:

Exports

KindNameDeclarationModulePackage
jsblockquoteDirectiveAriaidrefSlotblockquoteDirectiveAriaidrefSlot./BlockquoteDirectiveAriaidrefSlot.js
1.1.9

9 months ago

1.1.10

9 months ago

1.1.8

9 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

12 months ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.0

1 year ago

1.1.0

1 year ago