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

Modern tooltip covering QCBX #3401

Closed
grantfitzsimmons opened this issue Apr 24, 2023 · 2 comments · Fixed by #3440
Closed

Modern tooltip covering QCBX #3401

grantfitzsimmons opened this issue Apr 24, 2023 · 2 comments · Fixed by #3440
Assignees
Labels
1 - Bug Incorrect behavior of the product
Projects

Comments

@grantfitzsimmons
Copy link
Contributor

Reported By: RBGE

We have been finding that the position of the pop up for Query Combo Boxes which lists ‘Searched Fields’ is getting in the way of the dropdown:

image

@grantfitzsimmons grantfitzsimmons added 1 - Bug Incorrect behavior of the product pri:unknown labels Apr 24, 2023
@maxpatiiuk
Copy link
Member

@CarolineDenis this can be fixed by making that tooltip appear on top of the box instead.

Read the tooltip documentation to see how to achieve that -

/**
* # An integration with the Floating UI library to provide tooltips.
*
* ## Documentation of our solution
*
* - Use "title" attribute on elements to provide a tooltip.
* - Can use a "data-title-delay" to customize the delay before the tooltip is
* shown (in milliseconds). I.e, set to 0 to disable delay.
* - To reduce bugs and simplify refactoring, use the titleDelay
* variable rather than hard coding the attribute name.
* - Can use a "data-title-position" to customize the preferred position of the
* tooltip (if there is not enough space, it will pick a second best position
* automatically). Allowed values: "top", "bottom", "left", "right".
* - To reduce bugs and simplify refactoring, use the titlePosition
* variable rather than hard coding the attribute name.
*
* ## Reasoning behind the current solution
*
* Default browser tooltips were unsatisfactory because:
* - They are displayed after a long delay
* - They are displayed with very small font
*
* While Floating UI's documentation shows examples of creating React components
* that can be used in place of "title" attributes were tooltips are necessary,
* that solution was not acceptable for the following reasons:
*
* - It requires a lot of boilerplate code. Way more than just having a "title"
* attribute.
* - It would require migrating all the usages in the code
* - It would be easy to forget to use the tooltip and use "title". What is
* even more likely, new people joining the project won't know about the
* existence of a custom tooltip element, and so would be using "title"
* - Floating UI's tooltips don't work for disabled elements because events
* are not triggered for disabled elements. Their workaround it to use
* aria-disabled attribute which is not a good solution:
*
* - Using aria-disabled event listeners are fired. Specify 7 relies in
* many places on the fact that event listeners are not fired for
* disabled elements
* - "aria-disabled" would still leave the element focusable, unlike
* disabled
* - Would still have to rewrite all the places in the code that use
* disabled to use aria-disabled
* - Same problem that it's easy to forget to use aria-disabled or for new
* developers to not know that they have to use aria-disabled
*
* Instead, I retrofitted the Floating UI library to work with "title"
* attribute. This required reimplementing their useHover() and useFocus()
* hooks. Their source code was used as an inspiration for useInteraction()
* hook which aimed to be a replacement (although small differences are likely
* present). useInteraction() looks at the "title" attribute, but also
* "data-title-delay" and "data-title-placement".
*
* For disabled elements, since events are not fired, browser's default
* tooltip is displayed.
*
*/

@maxpatiiuk maxpatiiuk added this to Unsorted in UI Refactor via automation Apr 25, 2023
CarolineDenis added a commit that referenced this issue May 2, 2023
UI Refactor automation moved this from Unsorted to Shipped May 5, 2023
@specifysoftware
Copy link

This issue has been mentioned on Specify Community Forum. There might be relevant details there:

https://discourse.specifysoftware.org/t/specify-7-8-11-release-announcement/1174/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product
Projects
Status: Done
UI Refactor
  
Shipped
Development

Successfully merging a pull request may close this issue.

4 participants