Commit Graph

12 Commits

Author SHA1 Message Date
Tom Byers
4dcdb83e44 Remove id from table used for the row numbers
The fullscreenTable component has 2 layers to the
table you see onscreen:
1. the actual data table
2. a clone, with only the first column showing,
   that sits on top so the row numbers stay in
   place while you scroll

Table 1. has an id attribute on its caption. The
region wrapping it has an aria-describedby
attribute with the id as its value. This makes the
caption the description for the region.

This isn't needed for the clone and
makes the HTML invalid because ids should be
unique.

This removes the id from the cloned table.
2021-02-18 15:08:27 +00:00
Tom Byers
cf07d79024 Make difference between table frames obvious
...by naming the attributes related to
accessibility.

Also includes tests for this.
2020-09-23 10:33:58 +01:00
Tom Byers
041f061dec Make only the scrollable table focusable
The JS clones the scrollable table so was passing
its attributes across to the fixed one (which
provides the row headings).

This bug was pushed in:

https://github.com/alphagov/notifications-admin/pull/3637
2020-09-23 09:58:27 +01:00
Tom Byers
de89e3cc11 Make fullscreen focusable
Includes:
- adding tabindex=0 to make it focusable
- giving it a focus style matching GOVUK Frontend
- giving it a label matching the table caption

Taken from this article:

https://adrianroselli.com/2017/11/a-responsive-accessible-table.html#ResponsiveScrollingKeyboard
2020-09-19 22:03:45 +01:00
Tom Byers
6b0b0dd263 Change method of getting scrollTop
The current method reports `0` in Safari, whatever
the scroll position.

Some testing across our browser matrix shows:
1. this is also the case on IOS
2. browsers in the matrix all support
   `$(window).scrollTop()`

https://scroll-position-test-page.glitch.me/#results

This changes the method to use
`$(window).scrollTop()` instead.
2019-12-03 13:27:48 +00:00
Tom Byers
92626c3f41 Change method of hiding extra table layer
This module creates a clone of the existing table
as an extra layer which sits on top of it.

This allows the row headers to sit above the table
content when it scrolls.

We were setting `role=presentation` on the extra
table to hide it from assistive technologies.

It seems that this wasn't working. From the spec'
`role-presentation` should remove the semantics of
the table but leave the content.

Testing in Safari, with the OSX Accessibility
Inspector, this isn't happening and the table is
still being reported as a table by the
accessibility API.

This changes to the `aria-hidden` attribute, to
make sure the extra table is ignored.
2019-08-16 16:23:29 +01:00
Tom Byers
1082a37750 Update call out to sticky JS, with test for it 2019-06-12 16:03:26 +01:00
Chris Hill-Scott
54bd321504 Make the example spreadsheet scroll horizontally
This replicates how we let large spreadsheets scroll horizontally.

Pro: this looks nicer and is more usable

Con: the code for this feels a bit fragile, especially the calling of
`.maintainWidth` twice, ie as many times as a it takes to get stuff to
render properly.
2018-11-01 15:31:14 +00:00
Chris Hill-Scott
784f577c4d Improve redraw performance
It’s noticeable when clicking from row to row in the spreadsheet that
the page jumps around a fair bit on load because there are a couple of
Javascript-powered components.

This commit makes sure:
- the radio select component doesn’t change height when rendering for
  the first time
- the scrollable table doesn’t show parts of the table that should be
  hidden by overflow for a fraction of second before all the JS has
  run
- the right-hand shadow on horizontally scrollable tables doesn’t fade
  in on initial page load but shows at 100% opacity immediately
2018-01-15 14:45:38 +00:00
Chris Hill-Scott
aa22568c64 Fix bug horizontal scrollbar being pushed off page
We weren’t calculating the height quite right; we were trying to
compensate for something that should have been compensated for in the
`stick-at-top-when-scrolling` code.

Add the 5px to the shim there is required because we’re adding it to the
element that the shim in replacing.
2017-12-20 15:37:34 +00:00
Chris Hill-Scott
c6f54966bf Change tables to scroll in-page, not full screen
There were three problems with showing tables fullscreen:
- it was over-optimised for very big spreadsheets, whereas most users
  will only have a few columns in their files
- it was jarring to go from full screen and back to the normal layout
- it was a bit change for existing users, where we prefer incremental
  changes that make things better without disrupting people’s work
  (where possible)

So this commit changes the big table to scroll horizontally in the page,
not take up the full width of the page.

From the fullscreen table it keeps:
- the shimming method to keep the horizontal scrollbar at the bottom of
  the screen at all times

It introduces some more refinements to make it nicer to use:
- fixing the first column, so you always know what row you’re on
- adding shadows indicate where there is content that’s scrolled outside
  the edges of the container
2017-12-20 12:09:18 +00:00
Chris Hill-Scott
8bfb67c702 Go fullscreen for row-level errors in spreadsheets
Two bits of context:

1. As we start dealing with letters, which have more columns, it’s more
   likely that people’s spreadsheets won’t fit in our current layout.

2. We already removed the view of the template from the page that shows
   row-level errors (eg bad phone number or missing personalisation) in
   spreadsheets because you don’t need to know about the content of the
   message in order to fix the errors.

This commit goes further by removing anything that isn’t to do with
the errors, including the normal GOV.UK header and the service’s
navigation.

This means the content can go the width of the page, which means it can
be allowed to scroll horizontally without being a usability car
crash. Which means that the layout doesn’t break with a spreadsheet that
has lots of columns.
2017-12-20 12:09:18 +00:00