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

Fix tooltips with Tippy.js #120

Merged
merged 12 commits into from
Jun 22, 2022
Merged

Conversation

janfaracik
Copy link
Contributor

This PR fixes tooltips for Jenkins #6408 which replaces YUI tooltips with Tippy.js ones.

Essentially the fix is to reregister the tooltips once a new item has been added otherwise Tippy won't know about the new element.

Thanks @timja :)


  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

I tested on 2.277.1 and with jenkinsci/jenkins#6408

Works fine and looks much better with the new core PR

@timja timja requested a review from daniel-beck May 2, 2022 14:42
@daniel-beck
Copy link
Member

daniel-beck commented May 2, 2022

Screenshot 2022-05-02 at 21 43 36

Is this a side effect of the new non-HTML by default behavior? If so, how do I prevent XSS on old Jenkins and get sane tooltips on new Jenkins? Would window.registerTooltips be how I check for the presence of Tippy?

@timja
Copy link
Member

timja commented May 2, 2022

Would window.registerTooltips be how I check for the presence of Tippy?

Yes

If so, how do I prevent XSS on old Jenkins and get sane tooltips on new Jenkins

Use html-tooltip if you want HTML, although not sure if f:checkbox will expose it currently

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

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

Checking and unchecking a checkbox takes seconds to apply. There needs to be a better solution than this.

@daniel-beck daniel-beck dismissed their stale review May 2, 2022 20:12

Weird, not reproducible right now

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

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

Checking and unchecking a checkbox takes seconds to apply. There needs to be a better solution than this.

(I forgot that I restarted with 2.345 rather than the incremental, so everything was fast 😑)

@timja timja marked this pull request as draft May 2, 2022 20:56
@timja timja marked this pull request as ready for review May 2, 2022 22:19
@timja timja requested a review from daniel-beck May 2, 2022 22:19
data-message-empty="${%groupEmpty}"
data-message-error="${%groupError}"
/>
<div class="jenkins-!-margin-top-2">
Copy link
Member

Choose a reason for hiding this comment

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

minor spacing fix, can extract if needed

Copy link
Member

Choose a reason for hiding this comment

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

Is this CSS class one that I can rely on existing in the future?

Copy link
Member

Choose a reason for hiding this comment

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

Yes it's a stable API, documented at:
https://weekly.ci.jenkins.io/design-library/Spacing/

Comment on lines +196 to +197
<f:helpLink featureName="${%Permissions matrix}" url="${descriptor.find('hudson.security.GlobalMatrixAuthorizationStrategy$DescriptorImpl').getHelpFile('user-group')}"/>
<f:helpArea />
Copy link
Member

Choose a reason for hiding this comment

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

fixes display of help link if ambiguous warning is on the page

@daniel-beck
Copy link
Member

Nice, the current state no longer opens the browser built-in tooltip after clicking a checkbox.

Is it necessary to have the tooltips interactable? With a grid like matrix-auth's, it's annoying to move the pointer up and rather than disappear and allowing me to interact with the row of checkboxes, the tooltip is now itself the hovered element (and I can select text etc. from it).

@timja
Copy link
Member

timja commented May 3, 2022

Is it necessary to have the tooltips interactable?

hmm on the demo on https://atomiks.github.io/tippyjs/ it doesn't do that, looking

I assume it's the interactive: true, in the tooltips.js file

For some reason only the html ones are interactive

@timja
Copy link
Member

timja commented May 3, 2022

I assume it's the interactive: true, in the tooltips.js file

tested and yes it's that, it behaves how you expect without it, asked on https://github.com/jenkinsci/jenkins/pull/6408/files#r863493271

@timja
Copy link
Member

timja commented May 10, 2022

@daniel-beck any chance of another review please, thanks!

@janfaracik
Copy link
Contributor Author

Heya @daniel-beck, any update on this? Cheers :)

@daniel-beck
Copy link
Member

TIL this is blocking the core fix. Sorry about that.

@daniel-beck
Copy link
Member

Would window.registerTooltips be how I check for the presence of Tippy?

Yes

That didn't survive a code reorg in the core PR: #130 (comment)

Comment on lines +240 to +242
if (window.registerTooltips) {
window.registerTooltips(e.nextSibling.parentElement);
}
Copy link
Member

Choose a reason for hiding this comment

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

What was the purpose of this? It doesn't work since jenkinsci/jenkins#7464 renamed the method, and the other occurrence of registerTooltips was fixed up in #130, but this code still exists.

Copy link
Member

Choose a reason for hiding this comment

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

I think it was fixed in core itself with behaviour and then applying subtree here.

the purpose was so that when checkboxes were dynamically added they would have tippy run on this but it was fixed in another way...

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.

4 participants