Updating some of the full screen table code

This commit is contained in:
Jonathan Bobel
2025-04-22 10:45:11 -04:00
parent b6a6ffb2ab
commit 1b9e19072e
3 changed files with 4 additions and 25 deletions

View File

@@ -22,7 +22,6 @@
this.$scrollableTable
.on('scroll', this.toggleShadows)
.on('scroll', this.maintainHeight)
.on('focus blur', () => this.$component.toggleClass('js-focus-style'));
if (
window.GOVUK.stickAtBottomWhenScrolling &&
@@ -31,17 +30,17 @@
window.GOVUK.stickAtBottomWhenScrolling.recalculate();
}
this.maintainWidth();
this.maintainWidth();npm
};
this.insertShims = () => {
const attributesForFocus = 'role aria-labelledby tabindex';
const attributesForFocus = 'role aria-labelledby';
let captionId = this.$table.find('caption').text().toLowerCase().replace(/[^A-Za-z]+/g, '');
this.$table.find('caption').attr('id', captionId);
this.$table.wrap(`<div class="fullscreen-scrollable-table" role="region" aria-labelledby="${captionId}" tabindex="0"/>`);
this.$table.wrap(`<div class="fullscreen-scrollable-table" role="region" aria-labelledby="${captionId}"/>`);
this.$component
.append(

View File

@@ -77,7 +77,7 @@
<div class="spreadsheet" data-module="fullscreen-table">
{% call(item, row_number) list_table(
example,
caption="Example",
caption="Example spreadsheet",
caption_visible=False,
field_headings=[''] + column_headings
) %}

View File

@@ -347,24 +347,4 @@ describe('FullscreenTable', () => {
});
describe("when the table is focused", () => {
beforeEach(() => {
// start module
window.GOVUK.modules.start();
tableFrame = document.querySelector('.fullscreen-scrollable-table');
tableFrame.focus();
});
test("it should make the parent frame a focus style", () => {
expect(container.classList.contains('js-focus-style')).toBe(true);
});
});
});