Skip to content

Conversation

DavidAnson
Copy link
Contributor

@DavidAnson DavidAnson commented Jun 22, 2025

@haslinghuis asked me to look at removing this project’s use of jBox. Part 1/2 of that can be found in #4484; this is Part 2/2. However, whereas replacing model dialogs could be done ~without compromise, removing tooltips may not be as clean.

First, the good news:

  • This implementation is a CSS-only approach that leverages much of the existing infrastructure. You'll see the code diff is small and well-contained. No code needs to be run to display tooltips and the DOM is not bloated by extra elements.
    • The “Configuration” tab is a good place to play around without hitting too many sharp corners.
  • Because of the use of CSS hover, tooltips open immediately (but I do not see this as a problem).

Next, some problems with the prototype that can be fixed:

  • The prototype ALSO displays standard HTML tooltips because of the (existing) use of the “title” attribute. This redundant behavior could be avoided by using a different attribute, but I left it in to show that native HTML tooltips are ALSO an option. However, they cannot be styled at all, and I assumed that was a dealbreaker. But what's nice about native HTML tooltips is that they should be fully accessible and would be even simpler than this diff. They’re not very pretty, but are guaranteed to work everywhere. :)
  • Line breaks can be used in the proposed CSS tooltip approach (FYI, they work with native HTML tooltips also). I have converted one example: the “?” to the right of the “Choose a Board” message on the “Firmware Flasher" tab. Updating requires replacing <br> with \n in about 200 places in the localized strings file, which is easy but not something I wanted to do proactively.
  • Every CSS tooltip opens to the right because it doesn't know any better. While that’s usually fine, when it happens for elements at the right side of the screen, the tooltip gets clipped. The best way I see to fix this is to use a dedicated CSS class name for the handful of tooltips that need to open left (ex: cf_tip_left). This would be a simple, one-time manual change. If we wanted to run some code, maybe each tab could be scanned after initialization and updated at runtime. I didn't want to spend time on this prematurely.
    • You can see examples where opening left is necessary on the "PID Tuning" tab.

Finally, the bad news:

  • This CSS tooltip approach does not support HTML syntax at all. (And neither do native HTML tooltips.) Styling within tooltips is not used extensively by this project, BUT there are various instances of emphasis and some hyperlinks, all of which would need to be converted to plain text. The “Choose a Board” example above includes one such link at the end. In general, the lack of styling is not a usability catastrophy, but it represents a regression from where things are today. Again, the “Choose a Board” example shows an example of the text “Cloud Build” losing its bold styling.

I don't know how big a deal loss of formatting is and I don't see a clean way around it other than moving to a dedicated library for tooltips. But at that point, it's not clear to me why the project wouldn't just stay with jBox which is already implemented and working. There could be size or performance benefits to a different library, but I'm not familiar enough with the landscape to recommend one. I didn't explore this option, but assume something could be found with similar requirements as jBox.

So that's the state of things as I understand them. I'd ask interested parties to please play around with this prototype to get sense of what the compromises are. Then let me know what you think! :)

Note: The OSD tab has its own call to initialize jBox/Tooltip. It looks similar, so I did not spend time on that tab assuming there won't be any new issues there.

Copy link
Contributor

coderabbitai bot commented Jun 22, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@DavidAnson
Copy link
Contributor Author

DavidAnson commented Jun 22, 2025

Okay, it looks like the little callout arrow is pointing the wrong way on Chrome. I do all my dev work on Safari, so didn't notice this until now. I'll look at fixing that, but it shouldn't block evaluation. Nope, I'm just a dingbat who didn't completely undo an experiment. Sigh... This is fixed.

@haslinghuis
Copy link
Member

@DavidAnson

  • please rebase on master for testing
  • my initial thought was using V-tooltip (floating-vue)

Copy link

sonarqubecloud bot commented Jul 9, 2025

Copy link
Contributor

github-actions bot commented Jul 9, 2025

Preview URL: https://2f61cfe0.betaflight-configurator.pages.dev

@DavidAnson
Copy link
Contributor Author

  • please rebase on master for testing

Done.

  • my initial thought was using V-tooltip (floating-vue)

The docs suggest this could be straightforward (https://floating-vue.starpad.dev/guide/). I'll have a look, but it may not be till later this month.

@DavidAnson
Copy link
Contributor Author

I spent a bit of time on this and forgot to link to it, but here is the VERY simplest of code that uses floating-vue to implement tool tips in Betaflight: DavidAnson@3b3cfe9

No styling, formatting, etc., just the first thing I got working.

@DavidAnson
Copy link
Contributor Author

^^ Okay, now there's a LITTLE bit of styling.

@nerdCopter
Copy link
Member

nerdCopter commented Jul 15, 2025

i think all of these font sizes were inadvertently reduced -- not matching surrounding sizes.
image

@DavidAnson
Copy link
Contributor Author

@nerdCopter, as part of THIS draft commit? Most of the CSS changes here should be scoped to tooltip UI, but there ARE 3 overflow:hidden that were removed for the initial CSS-only proposal. Those changes should not be necessary with the floating-vue proposal, so I will remove them as I work on that more. However, I would not expect any of the CSS changes to affect font sizes outside tooltips. (Though it's possible someone used a tooltip CSS class where they shouldn't have?)

@nerdCopter
Copy link
Member

@DavidAnson , my sincere apologies, such is the case in master as well.

@DavidAnson
Copy link
Contributor Author

@nerdCopter, no problem, I'm just glad I don't need to track that down! :)

@haslinghuis
Copy link
Member

Superseded by #4582

@github-project-automation github-project-automation bot moved this from App to Done in 2025.12.0 Aug 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants