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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite tooltips to vanilla JS #4383

Merged
merged 4 commits into from Apr 21, 2022
Merged

Rewrite tooltips to vanilla JS #4383

merged 4 commits into from Apr 21, 2022

Conversation

aschempp
Copy link
Member

The new implementation should behave and look exactly the same, but has some subtle but useful improvements:

  • it only ever uses one DOM element for all tips, and that element is much simpler (just a DIV with text content). Previously every tip (once used) created its own DOM element wich consisted of multiple DIVs.
  • it keeps the title attribute on elements, until these are focussed by mouse pointer. I would assume this is better for accessibility.
  • It automatically updates to any changes of the title attribute (or the tip content) since it is retrieved whenever the element is mouse-hovered. That's also why we don't need Backend.retrieveInteractiveHelp anymore before copying an element in wizards.
  • It automatically hides the tip when clicking button or links, therefore we don't need Backend.hideInteractiveHelp anymore. This was previously only the case for buttons, but now also magically works e.g. for our module wizard in layouts. 馃槑

It is (currently) not supported for developers to add their own tips (= register their own element for tips). But since the core automatically uses tips for basically anything with a title attribute, I don't think that's really necessary.

@aschempp aschempp added this to the 5.0 milestone Mar 24, 2022
@aschempp aschempp requested a review from a team March 24, 2022 13:01
@aschempp aschempp self-assigned this Mar 24, 2022
@leofeyer
Copy link
Member

leofeyer commented Apr 6, 2022

Did you test that this also works with subpalettes that are loaded via Ajax?

@aschempp
Copy link
Member Author

aschempp commented Apr 7, 2022

Did you test that this also works with subpalettes that are loaded via Ajax?

yes, that's why we use the MutationObserver 馃槑

aschempp and others added 3 commits April 7, 2022 15:21
# Conflicts:
#	core-bundle/src/Resources/contao/templates/backend/be_main.html5
#	core-bundle/src/Resources/public/core.min.js
@leofeyer leofeyer merged commit 9b751a4 into contao:5.x Apr 21, 2022
@aschempp aschempp deleted the fix/vanilla7 branch April 21, 2022 06:35
@ausi ausi mentioned this pull request Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants