mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 01:55:41 -04:00
Updating some of the full screen table code
This commit is contained in:
@@ -22,7 +22,6 @@
|
|||||||
this.$scrollableTable
|
this.$scrollableTable
|
||||||
.on('scroll', this.toggleShadows)
|
.on('scroll', this.toggleShadows)
|
||||||
.on('scroll', this.maintainHeight)
|
.on('scroll', this.maintainHeight)
|
||||||
.on('focus blur', () => this.$component.toggleClass('js-focus-style'));
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
window.GOVUK.stickAtBottomWhenScrolling &&
|
window.GOVUK.stickAtBottomWhenScrolling &&
|
||||||
@@ -31,17 +30,17 @@
|
|||||||
window.GOVUK.stickAtBottomWhenScrolling.recalculate();
|
window.GOVUK.stickAtBottomWhenScrolling.recalculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.maintainWidth();
|
this.maintainWidth();npm
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.insertShims = () => {
|
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, '');
|
let captionId = this.$table.find('caption').text().toLowerCase().replace(/[^A-Za-z]+/g, '');
|
||||||
|
|
||||||
this.$table.find('caption').attr('id', captionId);
|
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
|
this.$component
|
||||||
.append(
|
.append(
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
<div class="spreadsheet" data-module="fullscreen-table">
|
<div class="spreadsheet" data-module="fullscreen-table">
|
||||||
{% call(item, row_number) list_table(
|
{% call(item, row_number) list_table(
|
||||||
example,
|
example,
|
||||||
caption="Example",
|
caption="Example spreadsheet",
|
||||||
caption_visible=False,
|
caption_visible=False,
|
||||||
field_headings=[''] + column_headings
|
field_headings=[''] + column_headings
|
||||||
) %}
|
) %}
|
||||||
|
|||||||
@@ -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);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user