Re: [csswg-drafts] [css-ui] Standardize tooltip styling and expose as `::tooltip` (#8930)

In preparation for the F2F, I think these are some questions we need to answer: 

- We need to hear from implementors on the potential limitations for such a feature
- We should decide on scope for Level 1, Level 2+, and non-goals. I think we are in agreement that this should cater to simpler use cases, and more complex cases should be handled via the popover API, however I don't think we have consensus on the specifics. Some questions that were raised (see OP and [@mfreed7’s comment](https://github.com/w3c/csswg-drafts/issues/8930#issuecomment-1629782521)) were:
 - Should this feature do simple tooltips that are *not* produced via the `title` attribute / `<title>` SVG element?
 - Should it deal with positioning? 
 - Should it deal with customizing the user actions that trigger the tooltip?
 - Should it allow authors to customize the delay for showing the tooltip?
 - Should styled tooltips continue to be able to extend the window bounds? Also, is that window or viewport bounds (i.e. what happens with iframes)? This may require a tradeoff as it may limit the types of styling allowed, for security reasons, though in https://github.com/w3c/csswg-drafts/issues/8930#issuecomment-1589742042 I do question whether a tradeoff is necessary (of course this may not even be possible for customized tooltips, we don't know until we hear from implementors).
 - Should this feature allow global styling of tooltips or work like a pseudo-element, customizing the tooltip per subtree?

IMO:
- I think the primary reasons authors go for custom tooltips are to customize the **delay, animation, and basic styles** (backgrounds, fonts, colors), so I think these should be a priority for L1. Basic styles alone are not enough.
- The idea of providing a way for the UA to automagically draw a tooltip pointer is interesting (and does solve the issue of how do we expose the position of the tooltip in a useful way so that authors can draw it), though it seems hard to spec such a feature that follows the arbitrary tooltip styling (shadows, borders, strokes etc), not sure how it would fit in to the box model, and not sure how we could give authors control over the size/proportions of the arrow. Note that transitions also often need to take the arrow into account (e.g. growing/shrinking transitions would use the pointer tip as a `transform-origin`).
- I think we can do away with arbitrary tooltips from arbitrary attributes and scope it down to specifically the `title` attribute and `<title>`.
- Regarding the position of the tooltip, I’m hoping we could perhaps define it in terms of [Anchor Positioning](https://drafts.csswg.org/css-anchor-position-1), which may require changes to Anchor Positioning itself, to be able to describe the current behavior.
- My intuition is that most authors would trade extending window bounds for higher styling flexibility. I'd like us to really examine whether the tradeoff is necessary though, as I imagine it could be quite limiting for e.g. iframes.

-- 
GitHub Notification of comment by LeaVerou
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8930#issuecomment-1636837433 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 15 July 2023 17:38:51 UTC