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

Fix scroll jump voting investments #3113

Merged
merged 1 commit into from
Dec 19, 2018
Merged

Fix scroll jump voting investments #3113

merged 1 commit into from
Dec 19, 2018

Conversation

javierm
Copy link
Member

@javierm javierm commented Dec 18, 2018

References

Objectives

  • Improve our usability by letting users scroll the page consistently
  • Fix the flaky specs that appeared in spec/features/budgets/ballots_spec.rb:112 ("Ballots Voting Adding and Removing Investments Add a investment"), spec/features/budgets/ballots_spec.rb:282 ("Ballots Groups Change my heading") and spec/features/budgets/ballots_spec.rb:615 ("Ballots Permissions Insufficient funds (removed after destroying from sidebar)")

Explain why the test is flaky

When users scroll the page, the header nav bar changes its position on the screen to a fixed one, causing the space it was in to suddenly become empty, making the page scroll even further. If the user is a Capybara driver, that extra scroll might end on it not clicking the link it was trying to click.

The mouse cursor jumps too much when scrolling

Explain why your PR fixes it

Given the complexity of the elements surrounding our header nav bar and the CSS rules applied to it and its changes in height and font size, the easiest way to fix the problem is to remove the padding of this element, which is exactly the space which will be left empty when the element changes its position to a fixed one.

The mouse cursor scrolls normally

I've tried more complex solutions like adding extra elements with a padding that compensates the empty space or manually adding extra padding, as suggested in the articles above. However, maybe because the header nav bar changes in height and font size, these solutions looked worse, with the scroll never being smooth enough and the header getting more padding than it has now.

On the other hand, the chosen solution might be fragile and we might have this issue again if we change the related CSS.

Notes

There are other ways to make the affected tests pass without changing the code, like changing CSS rules for the test environment or increasing the window size of the Capybara driver so it doesn't need to scroll. However, IMHO these tests are failing because we've got a bug in our code (in this case, affecting usability). Changing the test so it passes without fixing the bug would make our test suite worse than it is now, since it wouldn't detect this usability issue.

Removing the padding in the investments header nav bar means it doesn't
leave any empty space when its position changes to a fixed one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants