Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove restoreScroll option #3019

Closed
jon-kirwan opened this issue Oct 17, 2022 · 0 comments · Fixed by #3029
Closed

Remove restoreScroll option #3019

jon-kirwan opened this issue Oct 17, 2022 · 0 comments · Fixed by #3029

Comments

@jon-kirwan
Copy link
Contributor

jon-kirwan commented Oct 17, 2022

What

Remove restoreScroll option

See https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/javascripts/component_guide/accessibility-test.js#L27

Why

The option has been removed. See dequelabs/axe-core#2388

Anything else

I'm pretty sure that the following test is related, which checks the scroll position is 0 before and after the test, and can be removed.

https://github.com/alphagov/govuk_publishing_components/blob/main/spec/javascripts/govuk_publishing_components/AccessibilityTestSpec.js#L87-L101

  it('should not scroll the page', function (done) {
    var bigElement = '<div style="height: 1000px; width: 100px;"></div>'

    addToDom(
      bigElement + '<a href="#">Low contrast</a>' + bigElement,
      'a { background: white; color: #ddd }'
    )

    expect(window.scrollY).toBe(0, 'should start at top of the page')

    AccessibilityTest(TEST_SELECTOR, function () {
      expect(window.scrollY).toBe(0, 'should end at top of the page')
      done()
    })
  })

The removed restoreScroll option reset the scroll position when checking scrollable elements for color-contrast violations. The test is no longer needed following performance improvements to how the color-contrast rule works which doesn't rely on scrolling the element into view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant