Conversation
The anchor attribute can be used to set up CSS anchor positioning by setting an implicit anchor element: https://drafts.csswg.org/css-anchor-1/#implicit-anchor-element
This patch also adds WPTs for the anchor attribute (without popovers) to support the HTML PR whatwg/html#9144 Fixed: 1432016 Change-Id: I3e80326268008e6beaf74389bb32c01050406a81
This patch also adds WPTs for the anchor attribute (without popovers) to support the HTML PR whatwg/html#9144 Fixed: 1432016 Change-Id: I3e80326268008e6beaf74389bb32c01050406a81 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4434155 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/main@{#1131479}
This patch also adds WPTs for the anchor attribute (without popovers) to support the HTML PR whatwg/html#9144 Fixed: 1432016 Change-Id: I3e80326268008e6beaf74389bb32c01050406a81 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4434155 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/main@{#1131479}
This patch also adds WPTs for the anchor attribute (without popovers) to support the HTML PR whatwg/html#9144 Fixed: 1432016 Change-Id: I3e80326268008e6beaf74389bb32c01050406a81 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4434155 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/main@{#1131479}
…r attribute changes, a=testonly Automatic update from web-platform-tests [anchor-position] Update layout on anchor attribute changes This patch also adds WPTs for the anchor attribute (without popovers) to support the HTML PR whatwg/html#9144 Fixed: 1432016 Change-Id: I3e80326268008e6beaf74389bb32c01050406a81 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4434155 Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/main@{#1131479} -- wpt-commits: db5d9506cb37895b200037877628911afd3fac14 wpt-pr: 39576
|
Before looking at this I'd like to see
topic: popover
|
|
I've moved my previous comment to #9311. |
|
@annevk I'm not sure I understand why this work is blocking on popover. Although popover is one place anchor would be useful, of course, it's not the only scenario - and it seems like popover's needs are addressed here. What is the scope of your concern for what needs to be investigated before anchor work can proceed? |
|
@josepharhar @tabatkins My initial thought looking at this is whether we can leverage presentation hints in some way instead of an "implicit anchor element", while still making it work conveniently for developers. The idea behind this seems fine to me though. |
|
@cwilso my concern is that popover landed in the standard with lots of issues that need to be addressed and it's been taking quite a long time for them to be addressed. That makes me uncomfortable about new features. |
I'm not sure how that would be possible. Without an implicit anchor element, you need a named anchor element, which means that, assuming we could craft an appropriate selector (not certain that's true, haven't thought about it enough) we'd have to reserve a name just for this use-case. And an element can only have one anchor name, so it would conflict with authors using an anchor name on the element for other purposes. (Even if we change to allow multiple anchor names, which there's an open issue about, we'd still conflict since CSS has never gained a way to add to a list.) So I don't think it's possible to do this, no. Skipping past the feasibility, tho, can I ask why you want to do this? If there's a particular reason you want to lean on presentational hints instead, I'd like to know in case it impacts other things architecturally. |
|
We want to ship this soon in chrome along with CSS anchor positioning so they can be used together. |
Fix the backlinks to the attribute definitions, which has the effect of causing the attribute definitions to show up in the input and button element definitions. (The newlines here are, unfortunately, important.) Also make popovertarget use the same "ID*" value space as other ID-accepting elements, as noted in #9144 (comment).
|
I agree that in its currently proposed form, the For what it is worth, and I am sure this has been mentioned already, I for one wouldn't necessarily object to a means of associating popover elements with some other element(s), since semantics of a popover may in the very least optionally permit it to relate to some element. For instance, form elements present what is essentially a popover element, to communicate e.g. validation errors, and said popover element would then naturally be related to the form control being validated. In fact, one could make the case that the association of a popover element with some other element is implicit, even if one is not specified, in which case the popover is associated with the entire document body. Which leads me to preliminarily conclude that there could be made a case for some HTML attribute to associate a popover element with another element. If the element related to a popover element, were to be removed [from the document], for instance, then it would by default remove (or at least hide) the popover element, such is the nature of the association proposed -- regardless of whether the popover element is in the other element's tree. For instance, there may be a popover element related to an entire Conclusively, |
This includes two related changes: 1. The showPopover() and togglePopover() methods now include an options bag that allows setting the popover source. 2. Popover sources (declaratively or imperatively set) now create an implicit anchor reference for that popover. See discussion in whatwg#9144 (comment). Closes whatwg#10442. Closes whatwg#10675.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Does creating custom ident dynamically via |
|
No, using |
Make test using it tentative, and remove the use where not needed. See web-platform-tests/wpt#53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Auto-Submit: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1474181}
Make test using it tentative, and remove the use where not needed. See #53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Auto-Submit: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1474181}
Make test using it tentative, and remove the use where not needed. See #53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Auto-Submit: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1474181}
…], a=testonly Automatic update from web-platform-tests HTML anchor attribute is not in a spec[1] Make test using it tentative, and remove the use where not needed. See web-platform-tests/wpt#53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Auto-Submit: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1474181} -- wpt-commits: 5a46d0ec81d0a67de1f697d405565abec5f89227 wpt-pr: 53169
…], a=testonly Automatic update from web-platform-tests HTML anchor attribute is not in a spec[1] Make test using it tentative, and remove the use where not needed. See web-platform-tests/wpt#53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Auto-Submit: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1474181} -- wpt-commits: 5a46d0ec81d0a67de1f697d405565abec5f89227 wpt-pr: 53169
…], a=testonly Automatic update from web-platform-tests HTML anchor attribute is not in a spec[1] Make test using it tentative, and remove the use where not needed. See web-platform-tests/wpt#53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruudchromium.org> Commit-Queue: Rune Lillesveen <futharkchromium.org> Auto-Submit: Rune Lillesveen <futharkchromium.org> Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org> Cr-Commit-Position: refs/heads/main{#1474181} -- wpt-commits: 5a46d0ec81d0a67de1f697d405565abec5f89227 wpt-pr: 53169 UltraBlame original commit: 7fd904d7332d63f49232d48cf85ac3c988c1354e
…], a=testonly Automatic update from web-platform-tests HTML anchor attribute is not in a spec[1] Make test using it tentative, and remove the use where not needed. See web-platform-tests/wpt#53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruudchromium.org> Commit-Queue: Rune Lillesveen <futharkchromium.org> Auto-Submit: Rune Lillesveen <futharkchromium.org> Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org> Cr-Commit-Position: refs/heads/main{#1474181} -- wpt-commits: 5a46d0ec81d0a67de1f697d405565abec5f89227 wpt-pr: 53169 UltraBlame original commit: 7fd904d7332d63f49232d48cf85ac3c988c1354e
…], a=testonly Automatic update from web-platform-tests HTML anchor attribute is not in a spec[1] Make test using it tentative, and remove the use where not needed. See web-platform-tests/wpt#53140 [1] whatwg/html#9144 Change-Id: I78d574cfe33c84031d067c308bfb364e56ba20e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6646507 Reviewed-by: Anders Hartvoll Ruud <andruudchromium.org> Commit-Queue: Rune Lillesveen <futharkchromium.org> Auto-Submit: Rune Lillesveen <futharkchromium.org> Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org> Cr-Commit-Position: refs/heads/main{#1474181} -- wpt-commits: 5a46d0ec81d0a67de1f697d405565abec5f89227 wpt-pr: 53169 UltraBlame original commit: 7fd904d7332d63f49232d48cf85ac3c988c1354e
|
Now that we have implicit anchors set up with invokers and the showPopover source argument, I don't think we need the anchor attribute anymore. |
Thanks @josepharhar - my understanding from this given the state of both invokers and showPopover is that custom element authors still need to do workarounds. Is this accurate? |
|
What is the custom element scenario that needs workarounds? I wonder if reference target would help? #10707 |
This feature is no longer needed now that invokers automatically set up implicit anchor relationships and showPopover takes an argument to set the invoker. I couldn't find any tracking bug specifically for the anchor attribute. Abandoned spec PR: whatwg/html#9144 Pinpoint 17390b0df10000: Charts-chartjs [ -0.5%, +0.2%] 👍 Charts-observable-plot [ -0.5%, -0.0%] Editor-CodeMirror [ -0.5%, +0.5%] Editor-TipTap [ -0.2%, +0.1%] NewsSite-Next [ -0.3%, +0.0%] NewsSite-Nuxt [ -0.2%, +0.3%] Perf-Dashboard [ -0.5%, +0.2%] React-Stockcharts-SVG [ -0.5%, +0.1%] 👍 Score [ +0.0%, +0.3%] TodoMVC-Angular-Complex-DOM [ -0.7%, +0.2%] TodoMVC-Backbone [ -0.4%, +0.3%] TodoMVC-JavaScript-ES5 [ -1.8%, +0.2%] TodoMVC-JavaScript-ES6-Webpack-Complex-DOM [ -0.8%, +0.2%] 👍 TodoMVC-Lit-Complex-DOM [ -0.8%, -0.0%] TodoMVC-Preact-Complex-DOM [ -0.9%, +0.8%] TodoMVC-React-Complex-DOM [ -0.3%, +0.3%] TodoMVC-React-Redux [ -0.3%, +0.0%] TodoMVC-Svelte-Complex-DOM [ -0.4%, +0.4%] TodoMVC-Vue [ -0.3%, +0.3%] 👍 TodoMVC-WebComponents [ -1.1%, -0.0%] TodoMVC-jQuery [ -0.3%, +0.6%] Change-Id: Ie982d3f9b297972532d119b9a31fd72b27164e49
This feature is no longer needed now that invokers automatically set up implicit anchor relationships and showPopover takes an argument to set the invoker. I couldn't find any tracking bug specifically for the anchor attribute. Abandoned spec PR: whatwg/html#9144 Pinpoint 17390b0df10000: Charts-chartjs [ -0.5%, +0.2%] 👍 Charts-observable-plot [ -0.5%, -0.0%] Editor-CodeMirror [ -0.5%, +0.5%] Editor-TipTap [ -0.2%, +0.1%] NewsSite-Next [ -0.3%, +0.0%] NewsSite-Nuxt [ -0.2%, +0.3%] Perf-Dashboard [ -0.5%, +0.2%] React-Stockcharts-SVG [ -0.5%, +0.1%] 👍 Score [ +0.0%, +0.3%] TodoMVC-Angular-Complex-DOM [ -0.7%, +0.2%] TodoMVC-Backbone [ -0.4%, +0.3%] TodoMVC-JavaScript-ES5 [ -1.8%, +0.2%] TodoMVC-JavaScript-ES6-Webpack-Complex-DOM [ -0.8%, +0.2%] 👍 TodoMVC-Lit-Complex-DOM [ -0.8%, -0.0%] TodoMVC-Preact-Complex-DOM [ -0.9%, +0.8%] TodoMVC-React-Complex-DOM [ -0.3%, +0.3%] TodoMVC-React-Redux [ -0.3%, +0.0%] TodoMVC-Svelte-Complex-DOM [ -0.4%, +0.4%] TodoMVC-Vue [ -0.3%, +0.3%] 👍 TodoMVC-WebComponents [ -1.1%, -0.0%] TodoMVC-jQuery [ -0.3%, +0.6%] Change-Id: Ie982d3f9b297972532d119b9a31fd72b27164e49 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7573956 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1590282}
This feature is no longer needed now that invokers automatically set up implicit anchor relationships and showPopover takes an argument to set the invoker. I couldn't find any tracking bug specifically for the anchor attribute. Abandoned spec PR: whatwg/html#9144 Pinpoint 17390b0df10000: Charts-chartjs [ -0.5%, +0.2%] 👍 Charts-observable-plot [ -0.5%, -0.0%] Editor-CodeMirror [ -0.5%, +0.5%] Editor-TipTap [ -0.2%, +0.1%] NewsSite-Next [ -0.3%, +0.0%] NewsSite-Nuxt [ -0.2%, +0.3%] Perf-Dashboard [ -0.5%, +0.2%] React-Stockcharts-SVG [ -0.5%, +0.1%] 👍 Score [ +0.0%, +0.3%] TodoMVC-Angular-Complex-DOM [ -0.7%, +0.2%] TodoMVC-Backbone [ -0.4%, +0.3%] TodoMVC-JavaScript-ES5 [ -1.8%, +0.2%] TodoMVC-JavaScript-ES6-Webpack-Complex-DOM [ -0.8%, +0.2%] 👍 TodoMVC-Lit-Complex-DOM [ -0.8%, -0.0%] TodoMVC-Preact-Complex-DOM [ -0.9%, +0.8%] TodoMVC-React-Complex-DOM [ -0.3%, +0.3%] TodoMVC-React-Redux [ -0.3%, +0.0%] TodoMVC-Svelte-Complex-DOM [ -0.4%, +0.4%] TodoMVC-Vue [ -0.3%, +0.3%] 👍 TodoMVC-WebComponents [ -1.1%, -0.0%] TodoMVC-jQuery [ -0.3%, +0.6%] Change-Id: Ie982d3f9b297972532d119b9a31fd72b27164e49 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7573956 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1590282}
This feature is no longer needed now that invokers automatically set up implicit anchor relationships and showPopover takes an argument to set the invoker. I couldn't find any tracking bug specifically for the anchor attribute. Abandoned spec PR: whatwg/html#9144 Pinpoint 17390b0df10000: Charts-chartjs [ -0.5%, +0.2%] 👍 Charts-observable-plot [ -0.5%, -0.0%] Editor-CodeMirror [ -0.5%, +0.5%] Editor-TipTap [ -0.2%, +0.1%] NewsSite-Next [ -0.3%, +0.0%] NewsSite-Nuxt [ -0.2%, +0.3%] Perf-Dashboard [ -0.5%, +0.2%] React-Stockcharts-SVG [ -0.5%, +0.1%] 👍 Score [ +0.0%, +0.3%] TodoMVC-Angular-Complex-DOM [ -0.7%, +0.2%] TodoMVC-Backbone [ -0.4%, +0.3%] TodoMVC-JavaScript-ES5 [ -1.8%, +0.2%] TodoMVC-JavaScript-ES6-Webpack-Complex-DOM [ -0.8%, +0.2%] 👍 TodoMVC-Lit-Complex-DOM [ -0.8%, -0.0%] TodoMVC-Preact-Complex-DOM [ -0.9%, +0.8%] TodoMVC-React-Complex-DOM [ -0.3%, +0.3%] TodoMVC-React-Redux [ -0.3%, +0.0%] TodoMVC-Svelte-Complex-DOM [ -0.4%, +0.4%] TodoMVC-Vue [ -0.3%, +0.3%] 👍 TodoMVC-WebComponents [ -1.1%, -0.0%] TodoMVC-jQuery [ -0.3%, +0.6%] Change-Id: Ie982d3f9b297972532d119b9a31fd72b27164e49 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7573956 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1590282}
The anchor attribute can be used to set up CSS anchor positioning by setting an implicit anchor element: https://drafts.csswg.org/css-anchor-1/#implicit-anchor-element.
The CSS properties used to set up anchor positioning relationships are perfect for repeating patterns, such as:
However, for structural patterns, such as when using a Popover, an HTML attribute has less boilerplate and makes the relationship much more directly observable:
This structural pattern can apply to other use cases also, where unique elements are paired.
When used with the Popover API, the
anchorattribute also naturally helps to create a relationship that ensures popovers are properly nested:This PR adds the
anchorattribute to HTML and connects it to the Popover API./dom.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/popover.html ( diff )
/references.html ( diff )
/rendering.html ( diff )