Skip to content

Commit

Permalink
use @query for fieldset
Browse files Browse the repository at this point in the history
  • Loading branch information
jamieomaguire committed Dec 12, 2024
1 parent d615f19 commit 1e81ef7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/components/pie-radio-group/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
type PropertyValues,
type TemplateResult,
} from 'lit';
import { property, queryAssignedElements, state } from 'lit/decorators.js';
import {
property, query, queryAssignedElements, state,
} from 'lit/decorators.js';
import {
RtlMixin,
defineCustomElement,
Expand Down Expand Up @@ -63,6 +65,9 @@ export class PieRadioGroup extends FormControlMixin(RtlMixin(LitElement)) implem
@queryAssignedElements({ selector: 'pie-radio' })
_slottedChildren!: Array<HTMLInputElement>;

@query('fieldset')
private _fieldset!: HTMLInputElement;

private _abortController!: AbortController;

/**
Expand Down Expand Up @@ -261,13 +266,10 @@ export class PieRadioGroup extends FormControlMixin(RtlMixin(LitElement)) implem
* @param {boolean} enable - Whether to enable (`true`) or disable (`false`) the `tabindex` on the `fieldset`.
*/
private _toggleFieldsetTabindex (enable: boolean): void {
const fieldset = this.shadowRoot?.querySelector('fieldset');

if (!fieldset) return;
if (enable) {
fieldset.setAttribute('tabindex', '0');
this._fieldset.setAttribute('tabindex', '0');
} else {
fieldset.removeAttribute('tabindex');
this._fieldset.removeAttribute('tabindex');
}
}

Expand Down

0 comments on commit 1e81ef7

Please sign in to comment.