Skip to content

Commit

Permalink
Fix table cells and inputs being read ad 'clickable' in NVDA (#5933)
Browse files Browse the repository at this point in the history
  • Loading branch information
deleonio authored Jan 24, 2024
2 parents 9ff83f9 + 0aaf631 commit a8f6fc5
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class KolInputColor implements InputColorAPI {
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.ref?.focus()}
role={`presentation` /* Avoid element being read as 'clickable' in NVDA */}
>
<span slot="label">
{hasExpertSlot ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class KolInputEmail implements InputEmailAPI {
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.ref?.focus()}
role={`presentation` /* Avoid element being read as 'clickable' in NVDA */}
>
<span slot="label">
{hasExpertSlot ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class KolInputFile implements InputFileAPI {
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.ref?.focus()}
role={`presentation` /* Avoid element being read as 'clickable' in NVDA */}
>
<span slot="label">
{hasExpertSlot ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class KolInputPassword implements InputPasswordAPI {
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.ref?.focus()}
role={`presentation` /* Avoid element being read as 'clickable' in NVDA */}
>
<span slot="label">
{hasExpertSlot ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class KolInputText implements InputTextAPI {
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.ref?.focus()}
role={`presentation` /* Avoid element being read as 'clickable' in NVDA */}
>
<span slot="label">
{hasExpertSlot ? (
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/select/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class KolSelect implements SelectAPI {
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.ref?.focus()}
role={`presentation` /* Avoid element being read as 'clickable' in NVDA */}
>
<span slot="label">
{hasExpertSlot ? (
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/textarea/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class KolTextarea implements TextareaAPI {
_tooltipAlign={this._tooltipAlign}
_touched={this.state._touched}
onClick={() => this.ref?.focus()}
role={`presentation` /* Avoid element being read as 'clickable' in NVDA */}
>
<span slot="label">
{hasExpertSlot ? (
Expand Down
7 changes: 5 additions & 2 deletions packages/samples/react/src/components/table/render-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ const HEADERS: KoliBriTableHeaders = {

/* Example 4: Render function using React */
render: (el) => {
el.setAttribute('role', 'presentation');
const renderElement = document.createElement('div');
renderElement.setAttribute('role', 'presentation');
el.innerHTML = '';
el.appendChild(renderElement);

/* https://react.dev/reference/react-dom/client/createRoot */
getRoot(el).render(
getRoot(renderElement).render(
<div
style={{
display: `grid`,
Expand Down

0 comments on commit a8f6fc5

Please sign in to comment.