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

USWDS - Tooltip: positioning fix #3963 #4062

Merged
merged 33 commits into from Mar 12, 2021

Conversation

scottqueen-bixal
Copy link
Contributor

@scottqueen-bixal scottqueen-bixal commented Mar 2, 2021

USWDS - Tooltip: positioning fix

closes Tooltip positioning #3915

Description

  • JS, not enough case logic to handle top and bottom fall back position. ie. if the content is not visible on top or bottom, it should allow for left or right positioning if possible
  • Styles, the constrained class that gets added before the position update occurs is not strict enough, it shouldn't be able to have a width that is too small.

This work;

  • improve the positioning logic by checking all available directions first, then compressing only if it does not fit on the screen
  • updates .usa-tooltip_body--wrap to include a max-width to keep the pseudo-element from being too small for the content

Test Coverage

Because these updates require multiple/various calculations of "client" values, (ie. clientHeight, offsetWidth) they would be best covered with e2e web-based functional testing, rather than mocked through our current JSDOM driven unit tests. See this request for JSDom also reference Unimplemented parts of the web platform via JSDom documentation.

  1. Navigate to : test/tooltip-utilities
    2a. Hover/tab over the "RSS" icon to display the tooltip, ensure that it is in line with the description across screen sizes
    2b. Hover/tab over the "Show on Right "<button> icon to display the tooltip, ensure that it is in line with the description across screen sizes

Before you hit Submit, make sure you’ve done whichever of these applies to you:

  • Follow the 18F Front End Coding Style Guide and Accessibility Guide.
  • Run npm test and make sure the tests for the files you have changed have passed.
    • currently failing a snyk test because of del ^6.0
  • Run your code through HTML_CodeSniffer and make sure it’s error free.
  • Title your pull request using this format: [Website] - [UI component]: Brief statement describing what this pull request solves.

gscottqueen and others added 30 commits January 27, 2021 12:42
@scottqueen-bixal scottqueen-bixal marked this pull request as ready for review March 2, 2021 21:02
Copy link
Contributor

@mejiaj mejiaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work and love the documentation!

@mejiaj mejiaj requested a review from thisisdano March 3, 2021 19:17
@mejiaj
Copy link
Contributor

mejiaj commented Mar 3, 2021

@thisisdano should we update the base branch to 2.11.0?

@thisisdano thisisdano changed the base branch from develop to uswds-2.11.0 March 12, 2021 07:37
@thisisdano thisisdano merged commit 5a5ba41 into uswds-2.11.0 Mar 12, 2021
@thisisdano thisisdano deleted the gscottqueen-gsq-tooltip-fix branch March 12, 2021 07:38
@thisisdano thisisdano linked an issue Mar 12, 2021 that may be closed by this pull request
This was referenced Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip positioning
4 participants