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
feat(material/tooltip): add option to open tooltip at mouse position #25202
feat(material/tooltip): add option to open tooltip at mouse position #25202
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this contribution - overall looks good to me. We could bikeshed on the input name and type, but I don't expect it to be that big of a deal.
One thing you'll want to do next is rebase to the latest version on main
since we just deprecated the tooltip in favor of the MDC version. Basically this tooltip was moved to a legacy-tooltip
folder and the MDC one was moved to this tooltip
folder. This shouldn't be too bad for this PR, since you made the changes in the base class, but I dont think any rebasing tools will make it trivial.
Also, can you add the tests to both versions of the tooltip?
set positionAtOrigin(value: BooleanInput) { | ||
this._positionAtOrigin = coerceBooleanProperty(value); | ||
this._detach(); | ||
this._overlayRef = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this null assignment should be placed in the detach
function - did you see any issues with putting it there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes there are issues: the show
function calls _createOverlay
(which returns the cached _overlayRef
if it has previously been created), and in the next line it calls _detach
, thus _overlayRef
would end up being null
and cause errors in the _updateTooltipMessage
. I could perhaps move the call to _detach
above the call to _createOverlay
, but I am not too familiar with the code and am trying not to break anything accidentally ^_^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, sounds okay to me
Add an input option `matTooltipPositionAtOrigin` to display the tooltip relative to the mouse or touch event that triggered it. Fixes #8759
…osition (angular#25202)" This reverts commit 1337f36.
… mouse position (angular#25202)" (angular#25430)" This reverts commit 08fba43.
…ltip at mouse position (angular#25202)" (angular#25430)"
…ltip at mouse position (angular#25202)" (angular#25430)"
…ltip at mouse position (angular#25202)" (angular#25430)"
…ltip at mouse position (angular#25202)" (angular#25430)"
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add an input option
matTooltipPositionAtOrigin
to display the tooltip relative to the mouse or touch event that triggered it.Fixes #8759