update comments

This commit is contained in:
Cory LaViska
2024-05-28 13:07:50 -04:00
parent 2d666a0c40
commit 2f470f129f
6 changed files with 16 additions and 14 deletions

View File

@@ -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
//

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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');
}

View File

@@ -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() {