Skip to content

Commit

Permalink
fix(table): update table caption warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
brentswisher committed Aug 30, 2024
1 parent b62160a commit 17900dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-cows-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ithaka/pharos': patch
---

Fix error message when no table caption is provided to recommend correct attribute to visually hide it
2 changes: 1 addition & 1 deletion packages/pharos/src/components/table/pharos-table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ it('throws an error if caption is not provided', async () => {
if (error instanceof Error) {
errorThrown = true;
expect(error?.message).to.be.equal(
'Table must have an accessible name. Please provide a caption for the table using the `caption` attribute. You can hide the caption visually by setting the `hide-caption-visually` property.'
'Table must have an accessible name. Please provide a caption for the table using the `caption` attribute. You can hide the caption visually by setting the `hide-caption` property.'
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/pharos/src/components/table/pharos-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class PharosTable extends ScopedRegistryMixin(PharosElement) {
protected override updated(): void {
if (!this.caption) {
throw new Error(
'Table must have an accessible name. Please provide a caption for the table using the `caption` attribute. You can hide the caption visually by setting the `hide-caption-visually` property.'
'Table must have an accessible name. Please provide a caption for the table using the `caption` attribute. You can hide the caption visually by setting the `hide-caption` property.'
);
}
this._pageSize = !this.showPagination ? this.rowData.length : this._pageSize;
Expand Down

0 comments on commit 17900dd

Please sign in to comment.