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

Modify tooltip positioning and tooltip triangle pointer positioning #1805

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

OleFosdal
Copy link

@OleFosdal OleFosdal commented Nov 21, 2024

  • Determine tooltip-content css-class solely in javascript method openPopup().
  • Added support for left/right alligned triangle pointer for top/bottom tooltip.
  • Added support for top/bottom alligned triangle pointer for left/right tooltip.
  • Recalculate left position for bottom/top tooltips if they extend right side of screen.
  • Recalculate top position for left/right tooltips if they extend bottom side of screen.

I made this solution before Commit a0f1545 ("Tooltip position updated when forced to change"), so unfortunately i have not implemented that current fix/solution. However i dont see the need for that with this current code.

Have tested DateGrid/Chart popups too and have tried to avoid configuring theese as much as possible.
The "reset" logic of removing all css-classes before adding new might be able to be done more cleanly.

@enchev
Copy link
Collaborator

enchev commented Nov 21, 2024

Have you tested the fix I've pushed? Your changes might affect drastically all components that are using popups - DataGrid, ContextMenu, DropDown/DropDownDataGrid, DatePicker, AutoComplete, etc.

@OleFosdal
Copy link
Author

OleFosdal commented Nov 21, 2024

Yea i feared that as well.
So even though it might not merge because of that, its a showcase for what i wished the tooltip might be able to do. Maybe in the future where there is more time to adjust.

The fix you showed still has some css problems with the triangle-pointer (hence why i try to modify the logic behind the css too).
image

In general i would have hoped that the "smartPosition" would have worked in a way where no position is given to the method, then it will auto-calculate where to position the tooltip with some priority maybe (first try bottom, then top etc.).
But when i define that it should be positioned bottom i would have hoped it stayed at the bottom and knowing the potential consequenses of it.

@enchev
Copy link
Collaborator

enchev commented Nov 22, 2024

Here are several issues I've found so far with this pull request:
image
image
image

In my opinion at the moment these changes will not solve the problems reported by you on the forum and will cause other problems with multiple components.

@OleFosdal
Copy link
Author

OleFosdal commented Nov 22, 2024

Did not know how to build for Material-base3. So try it in default theme or any free theme i assume.
Forgot to mention that in description.

Edit:
Never mind that does not work either. True there are some errors there for Popup.

Edit 2:
This was not actually intended change in the code. Might have been too quick to push. When checking for smartPosition i wanted to not use any of my added code by have done it anyway on line 1188.

@OleFosdal
Copy link
Author

OleFosdal commented Nov 22, 2024

After commit, i have tested all the popups i know of and they seem to be working now. They work like they use to (still smartPositions on both y- and x-axis when needed to. Aand only tooltips behave in a way of the new code.

But then again i know it is changing some fundamental code for all popups and there might be unforseen bugs. So understand why this might not be a viable solution.

Edit:
This .css does not apply for Material-base3 theme (and maybe others, have not tested all).
I checked the loaded .css for Material-base3 theme and the .css is still the old code so it has not compiled. I still dont know how to build the .css for this.

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.

2 participants