mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
update comments
This commit is contained in:
@@ -189,7 +189,7 @@ export default class WaCheckbox extends WebAwesomeFormAssociatedElement {
|
||||
const hasHelpText = this.helpText ? true : !!hasHelpTextSlot;
|
||||
|
||||
//
|
||||
// NOTE: we use a <div> around the label slot because of this Chrome bug.
|
||||
// NOTE: we use a `<div>` around the label slot because of this Chrome bug.
|
||||
//
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=1413733
|
||||
//
|
||||
|
||||
@@ -435,7 +435,7 @@ export default class WaColorPicker extends WebAwesomeFormAssociatedElement {
|
||||
const target = event.target as HTMLInputElement;
|
||||
const oldValue = this.value;
|
||||
|
||||
// Prevent the <wa-input>'s wa-change event from bubbling up
|
||||
// Prevent the `<wa-input>` element's `wa-change` event from bubbling up
|
||||
event.stopPropagation();
|
||||
|
||||
if (this.input.value) {
|
||||
@@ -454,7 +454,7 @@ export default class WaColorPicker extends WebAwesomeFormAssociatedElement {
|
||||
private handleInputInput(event: WaInputEvent) {
|
||||
this.updateValidity();
|
||||
|
||||
// Prevent the <wa-input>'s wa-input event from bubbling up
|
||||
// Prevent the `<wa-input>` element's `wa-input` event from bubbling up
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
@@ -732,8 +732,8 @@ export default class WaColorPicker extends WebAwesomeFormAssociatedElement {
|
||||
|
||||
if (this.hasFocus) {
|
||||
// We don't know which element in the color picker has focus, so we'll move it to the trigger or base (inline) and
|
||||
// blur that instead. This results in document.activeElement becoming the <body>. This doesn't cause another focus
|
||||
// event because we're using focusin and something inside the color picker already has focus.
|
||||
// blur that instead. This results in document.activeElement becoming the `<body>`. This doesn't cause another
|
||||
// focus event because we're using focusin and something inside the color picker already has focus.
|
||||
elementToBlur.focus({ preventScroll: true });
|
||||
elementToBlur.blur();
|
||||
}
|
||||
|
||||
@@ -212,7 +212,8 @@ export default class WaInput extends WebAwesomeFormAssociatedElement {
|
||||
//
|
||||
|
||||
/**
|
||||
* Gets or sets the current value as a `Date` object. Returns `null` if the value can't be converted. This will use the native `<input type="{{type}}">` implementation and may result in an error.
|
||||
* Gets or sets the current value as a `Date` object. Returns `null` if the value can't be converted. This will use
|
||||
* the native `<input type="type">` implementation and may result in an error.
|
||||
*/
|
||||
get valueAsDate() {
|
||||
this.__dateInput.type = this.type;
|
||||
|
||||
@@ -260,7 +260,8 @@ export default class WaPopup extends WebAwesomeElement {
|
||||
this.anchorEl = this.querySelector<HTMLElement>('[slot="anchor"]');
|
||||
}
|
||||
|
||||
// If the anchor is a <slot>, we'll use the first assigned element as the target since slots use `display: contents`
|
||||
// If the anchor is a `<slot>`, we'll use the first assigned element as the target since slots use
|
||||
// `display: contents`
|
||||
// and positioning can't be calculated on them
|
||||
if (this.anchorEl instanceof HTMLSlotElement) {
|
||||
this.anchorEl = this.anchorEl.assignedElements({ flatten: true })[0] as HTMLElement;
|
||||
|
||||
@@ -214,8 +214,8 @@ export default class WaSelect extends WebAwesomeFormAssociatedElement {
|
||||
|
||||
/**
|
||||
* A function that customizes the tags to be rendered when multiple=true. The first argument is the option, the second
|
||||
* is the current tag's index. The function should return either a Lit TemplateResult or a string containing trusted HTML of the symbol to render at
|
||||
* the specified value.
|
||||
* is the current tag's index. The function should return either a Lit TemplateResult or a string containing trusted
|
||||
* HTML of the symbol to render at the specified value.
|
||||
*/
|
||||
@property() getTag: (option: WaOption, index: number) => TemplateResult | string | HTMLElement = option => {
|
||||
return html`
|
||||
@@ -312,7 +312,7 @@ export default class WaSelect extends WebAwesomeFormAssociatedElement {
|
||||
const isClearButton = target.closest('.select__clear') !== null;
|
||||
const isIconButton = target.closest('wa-icon-button') !== null;
|
||||
|
||||
// Ignore presses when the target is an icon button (e.g. the remove button in <wa-tag>)
|
||||
// Ignore presses when the target is an icon button (e.g. the remove button in `<wa-tag>`)
|
||||
if (isClearButton || isIconButton) {
|
||||
return;
|
||||
}
|
||||
@@ -531,7 +531,7 @@ export default class WaSelect extends WebAwesomeFormAssociatedElement {
|
||||
// Select only the options that match the new value
|
||||
this.setSelectedOptions(allOptions.filter(el => value.includes(el.value)));
|
||||
} else {
|
||||
// Rerun this handler when <wa-option> is registered
|
||||
// Rerun this handler when `<wa-option>` is registered
|
||||
customElements.whenDefined('wa-option').then(() => this.handleDefaultSlotChange());
|
||||
}
|
||||
}
|
||||
@@ -550,12 +550,12 @@ export default class WaSelect extends WebAwesomeFormAssociatedElement {
|
||||
}
|
||||
}
|
||||
|
||||
// Gets an array of all <wa-option> elements
|
||||
// Gets an array of all `<wa-option>` elements
|
||||
private getAllOptions() {
|
||||
return [...this.querySelectorAll<WaOption>('wa-option')];
|
||||
}
|
||||
|
||||
// Gets the first <wa-option> element
|
||||
// Gets the first `<wa-option>` element
|
||||
private getFirstOption() {
|
||||
return this.querySelector<WaOption>('wa-option');
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ export default class WaTooltip extends WebAwesomeElement {
|
||||
//
|
||||
// NOTE: Tooltip is a bit unique in that we're using aria-live instead of aria-labelledby to trick screen readers into
|
||||
// announcing the content. It works really well, but it violates an accessibility rule. We're also adding the
|
||||
// aria-describedby attribute to a slot, which is required by <wa-popup> to correctly locate the first assigned
|
||||
// aria-describedby attribute to a slot, which is required by `<wa-popup>` to correctly locate the first assigned
|
||||
// element, otherwise positioning is incorrect.
|
||||
//
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user