-
Notifications
You must be signed in to change notification settings - Fork 669
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
[cssom-view] Proposal: add Element.isVisible[toDocument] to detect if element is visible in the document. #6850
Comments
Sounds reasonable though it'd be extremely weird that isRendered would return anything that doesn't match https://html.spec.whatwg.org/#being-rendered |
What about |
I think having it match https://html.spec.whatwg.org/#being-rendered is reasonable. I'm going to see if we can amend "being rendered" somehow to include |
After some more discussion here, would you support The problem is that we would really like this function to return false for Would it help if the name is not |
I may be bikeshedding here, but I have the feeling that this method should be called something else. for (const elem of list) {
if (elem.isRendered()) {
elem.before(newElement());
}
} the styles would get recalculated for the whole page at every iteration of the loop with sensible performance costs. I am really not good at naming, but maybe something like |
I propose we change to Definition:
I think this is better, because it is (a) clearly defined in terms of the spec, and (b) solves various use cases we've encountered well. Use cases include:
|
Here is some puppeteer code and some playwright code that could use this feature to work properly with content-visibility, as well as a playwright issue where someone ran into this shortcoming due to content-visibility in |
I'm a bit concerned about people expecting the later rather than the former... Though I can't come up with a particularly better name right away... Another possible concern is that the API would have to update style synchronously, which might defeat the optimizations it's trying to introduce... |
Me too. It could be simply Sebastian |
Re name: I agree Re sync style: this is definitely something to make sure we get right. The is-rendered and Worst-case performance summary:
(p.s. I updated the third bullet point of my proposal a few comments back to be accurate about skipped elements) |
I agree. Also note that even if we tie this function only to being rendered, the style update (of non-skipped parts) would still be required. I think the extra ancestor walk is a small price to pay to let developers reliably check and avoid computation in non-document-visible trees. Bikeshed: maybe isDocumentVisible instead of isVisibleToDocument? |
If this is about whether |
How about
There are two known use cases:
|
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: add Element.isVisible[toDocument]<fantasai> github: https://github.com//issues/6850 <fantasai> chrishtr: ... <fantasai> chrishtr: Need to do this to determine that things properly displayed <Rossen_> q? <Rossen_> ack florian_irc <fantasai> chrishtr: currently use approximations that are increasingly incorrect as we add more advanced rendering features <fantasai> chrishtr: When content is skipped using content-visiblity, protects code so that don't accidentally force-??? <fantasai> chrishtr: We've seen this problem when adopting content-visibility <fantasai> chrishtr: Proposed definition is that box has to be "rendered" per HTML, i.e. has a box <fantasai> chrishtr: 'visibility' is 'visible' <fantasai> chrishtr: not in the skipped subtree of content-visibility <fantasai> smfr: opacity:0 is visible, right? <fantasai> chrishtr: yes, and clipped out counts as visible <fantasai> smfr: so not really visible to the user, but some more subtle definition <fantasai> chrishtr: Also scrolled off-screen considered visible <lea> Seems like there's a lot of disagreement about the exact definition, what if this accepted a dictionary so that authors can define the type of "visibility" they need? <fantasai> chrishtr: so seems like need name to be slightly different, e.g. isVisibletoDocument <lea> Also, not sure how `isVisibleToDocument()` adds clarity over `isVisible()`, it mainly seems more verbose <fantasai> Rossen_: I wanted clarification on whether or not isVisible state here means that the box of the element is rendered inside the viewport or not <fantasai> Rossen_: Sounds like the answer is not necessarily? <fantasai> Rossen_: Seems like the definition is box of the element could potentially be viewable <fantasai> Rossen_: So, like, *can* be visible <Rossen_> q? <fantasai> lea: It seems there's a lot of uncertainty about the exact definition of this function <fantasai> lea: couldn't we have options so that authors can decide what type of visiblity they care about? <fantasai> lea: because clearly a single definition is not serving all use cases <Rossen_> ack lea <fantasai> lea: Also, isVisibleToDocument() doesn't seem to really add clarity, just adds verbosity <fantasai> <fantasai> +1 <fantasai> chrishtr: Not sure I understand use cses? <fantasai> lea: Some use cases need to know whether visible in viewport, some just need to know if there's a box, and some need to know if contents are rendered <fantasai> lea: so different use cases <fantasai> chrishtr: We did consult with reps from Pupeteer and Clearwrite <dholbert> q+ <fantasai> chrishtr: and they thought the definition was good for their use case <fantasai> chrishtr: and meets the needs of the content-visibility partners we have <florian_irc> q+ <fantasai> lea: As a web dev, testing whether a box is visible is something web developers have needed and use frequently <florian_irc> q- <fantasai> lea: adding isVisible that is a specific type of rendering for a specific use case <smfr> +1 to lea’s suggestion <fantasai> lea: if we're adding this new function, can't we add an ability that a majority of the authors need? <fantasai> +1 to lea <Rossen_> ack dholbert <fantasai> dholbert: I'm curious whether it makes sense to include visiblity: hidden in the definition <fantasai> dholbert: seems different category of visiblity than content-visiblity and display:none <fantasai> dholbert: visibility:hidden, you still have to compute layout with it <fantasai> dholbert: and authors are fully in control of it <lea> Potentially useful, as this has historically been used *a lot* by authors: https://api.jquery.com/visible-selector/#visible1 <fantasai> chrishtr: Maybe it makes sense to be more specific about what the function does, and maybe introduce multiple function <smfr> q+ <fantasai> chrishtr: e.g. has a box and not ?? <fantasai> chrishtr: visiblity can be checked directly with existing methods <lea> (jQuery implements as a selector, but it was used in the same way, to test visibility of a given element, for a certain definition of visibility) <fantasai> dholbert: opacity:0, as smfr mentioned; and then content covered up by other content <fantasai> chrishtr: so the only one is has a box and is not skipped <fantasai> chrishtr: I think that would meet the needs <fantasai> dholbert: only issue is that isVisible is a problematic name <lea> also, would be nice if it addressed use cases like https://stackoverflow.com/questions/123999/how-can-i-tell-if-a-dom-element-is-visible-in-the-current-viewport <Rossen_> a11y tools have been requesting such behavior for a very long time... yet I don't see that as a strong use case <florian_irc> fantasai: I suggest "isDisplayed", cause that's got more to do with what we are doing <florian_irc> fantasai: here, visibility variants isn't quite right <Rossen_> q <Rossen_> ack fantasai <fantasai> fantasai: displayed links to the idea of 'display' and the box <fantasai> s/box/box generation/ <fantasai> smfr: I like lea's idea of a more fine-grained approach <fantasai> smfr: could imagine 2 versions <fantasai> smfr: a function isVisible() takes a dictionary, which properties interested in <fantasai> smfr: another is returns a dictionary, which says which types of visibility involved in <fantasai> smfr: first one is more performant, don't have to calculate types that aren't needed <fantasai> smfr: ... <dbaron> (leaving the meeting now) <fantasai> s/.../if more fine-grained API, that removes ambiguity or confusion around things that affect visibility/ <Rossen_> ack smfr <Rossen_> ack lea <fantasai> lea: Pasted a linkto jQuery API for similar functionality <fantasai> lea: They've done a lot of work to address use cases <fantasai> lea: would be good to take prior art into account <fantasai> lea: seems they define as whether any layout boxes <fantasai> lea: but seems definition changed at one point <fantasai> lea: also linked to stack overflow, other places, ppl want to know whether an element is visible in the viewport <fantasai> lea: would be useful if it could do that as well <fantasai> lea: right now the way to test this is to create an intersection observer <fantasai> lea: but it's awkward to write code like that, so would be nice if there was a function that would just tell you <fantasai> lea: unsure if isDisplayed is more clear, would go with isVisible because shorter <vmpstr> q+ <Rossen_> q+ <fantasai> fantasai: just to clarify, I think if we're doing something general then isVisible is fine, but if limiting to whether the box is generated isDisplayed makes sense to me <fantasai> vmpstr: If going with dictionary approach, would dictionary be things like test viewport visibility, test display none, test ??? <Rossen_> ack vmpstr <fantasai> vmpstr: how would that work? <fantasai> lea: I think we should center around use cases rather than specific properties, so that it is more future proof <tantek> +1 leaverou, decide on the funtionality first, and then the name can follow <fantasai> lea: I propose we resolve to work on it, and go back to the drawing board and revisit later after redesigning <bradk> 👍 <fantasai> chrishtr: sgtm <tantek> +1 leaverou on all that. center around use-cases, revisit after redesigning <fantasai> Rossen_: Seems like we went down this path of content-visibility and trying to chunk how much content is processed and address perf gains, which is a good effort <fantasai> Rossen_: now we're trying to contain the damage <fantasai> Rossen_: ... things that were otherwise easily discoverable <fantasai> Rossen_: This type of functionality has been requested by accessibility tools for a long long time <fantasai> Rossen_: to recognize whether something is visible, can it be visible, where is it visible <fantasai> Rossen_: They have frameworks working around these problems <fantasai> Rossen_: trying to reverse-engineer engine's decisions and results <fantasai> Rossen_: so I don't see a11y considered anywhere in this issue, and would recommend we take these use cases as well <fantasai> Rossen_: in addition to ones described by Lea and Simon <Rossen_> q? <fantasai> Rossen_: Any other feedback to this issue? <fantasai> chrishtr: resolving as Lea suggested that use cases make sense and go back to issue makes sense <fantasai> chrishtr: Just want to make sure that WG has consensus that these use cases are worth solving <lea> +1 on the use cases being worth solving <lea> (that was the first part of the resolution I proposed :) <fantasai> Proposed Resolution: Work on solving these use cases for an isVisible API <fantasai> RESOLVED: Work on solving these use cases for an isVisible API and revisit in a future call |
Prior art:
Types of visibility:
Proposal: Pass an options dictionary to a new The justification for including use cases 1 and 2 by default is that there is no other way to do it at present, and these are the minimum requirements to be even possibly visible. The jQuery API also does this (plus a bit more).
IMO we should not add But this design allows them to be added in the future. |
@LeaVerou could you check out my proposal above? How does it sound? |
Here's some accessibility prior art, via @aleventhal. Chromium already implements an IsVisible value on accessibility objects internally, and exposes it to AT tools directly. The implementation is equivalent to the pseudocode below. The difference between this and my proposal above is that it checks for aria-hidden and inert.
|
I think inert and aria-hidden should also be optional attributes.
|
From a conversation with the Narrator/UIA folks at Microsoft, their perspective is that content that is not visible to a sighted user should not be included in the accessibility tree. This determination is performed by the user agent (and specifically in Chromium by the pseudocode Chris referenced above). Therefore, they don't see the need for any such API at the platform accessibility API level. However, one part of the proposal that I think I'm missing - what would |
I don't think the Narrator/UIA statement is detailed enough.
What about content that's scrolled off? That's not visible to a sighted
user, so shouldn't be included?
What about content that's behind other content in the z-order? Same Q.
What about content that's positioned offscreen (often done intentionally as
a technique to provide additional instructions to screen reader users).
IMO, what browsers do now is useful and works well with screen reader
expectations today. Not sure if there's a need to revisit any of this right
now TBH.
Regarding content-visibility: auto, it needs to be exposed so that screen
reader users can navigate by heading, etc. Unless someone sees a way around
that.
Aaron
…On Fri, Feb 4, 2022 at 3:31 PM Daniel Libby ***@***.***> wrote:
From a conversation with the Narrator/UIA folks at Microsoft, their
perspective is that content that is not visible to a sighted user should
not be included in the accessibility tree. This determination is performed
by the user agent (and specifically in Chromium by the pseudocode Chris
referenced above). Therefore, they don't see the need for any such API at
the platform accessibility API level.
However, one part of the proposal that I think I'm missing - what would
isVisible() return for an element in a content-visibility: auto subtree
where contents are skipped? Per #5857
<#5857>, these elements are
included in the accessibility tree (with the caveat that this may expose
more than the user will see once the contents are activated). If that is
the case, then perhaps an isVisible-like API for ATs could be useful - but
given the principles around the decision to include that content, I don't
know that we'd want to advise ATs to try and handle it separately than
their existing logic.
—
Reply to this email directly, view it on GitHub
<#6850 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKQAZUK6KKVWIALRN7ROIDUZQZTFANCNFSM5JFHLXJQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Good question. I think skipped descendants of a content-visibility: auto element should return true for isVisible, since if the user scrolled to them, they are indeed visible. And it also aligns with the accessibility code I inlined above, which is a good sign. Also note that calling |
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. X-original-commit: 5aa2a71
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes #91649 X-original-commit: 5aa2a71 Signed-off-by: Aaron Bohy (aab) <[email protected]> Signed-off-by: Pierre Paridans (app) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes #91662 X-original-commit: 5aa2a71 Signed-off-by: Aaron Bohy (aab) <[email protected]> Signed-off-by: Pierre Paridans (app) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. X-original-commit: 9f20e7f
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. X-original-commit: 9f20e7f
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. X-original-commit: 9f20e7f
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes #91778 X-original-commit: 9f20e7f Signed-off-by: Aaron Bohy (aab) <[email protected]> Signed-off-by: Pierre Paridans (app) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes #91764 X-original-commit: 9f20e7f Signed-off-by: Aaron Bohy (aab) <[email protected]> Signed-off-by: Pierre Paridans (app) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes #91790 X-original-commit: 9f20e7f Signed-off-by: Aaron Bohy (aab) <[email protected]> Signed-off-by: Pierre Paridans (app) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. X-original-commit: b718e7e
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes #91833 X-original-commit: b718e7e Signed-off-by: Aaron Bohy (aab) <[email protected]> Signed-off-by: Pierre Paridans (app) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes odoo#91649 X-original-commit: 5aa2a71 Signed-off-by: Aaron Bohy (aab) <[email protected]> Signed-off-by: Pierre Paridans (app) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes odoo#91568 Signed-off-by: Aaron Bohy (aab) <[email protected]>
Since Chromium 97, folded `<details>` content has non-zero computed width and height which returns false-positive QUnit `assert.isNotVisible()` calls. In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950 when Chromium implemented the ability for "Find in page" to search in folded `<details>`. To do so, the `content-visibility` rule was used instead of `display: none` which, even if functionally similar, has an impact on the values returned by `getBoundingClientRect()` (i.e. used in `assert.isNotVisible()`. A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028 to highlight this change of behavior. What emerged from this report's discussion is that Chromium has no intent to revert this change and instead put the emphasis on avoiding to use `getBoundingClientRect()` and similar methods for visibility check (even pushing a proposal for a `Element.isVisible()` API; cf. w3c/csswg-drafts#6850). This commit works around this issue by forcing the content to `display: none`, like in the previous Chromium versions. closes odoo/odoo#91568 Signed-off-by: Aaron Bohy (aab) <[email protected]>
I filed a proposal on whatwg/html#7379 but cross-posting it here, since cssom-view is likely a good place for speccing it if it is a good idea.
The issue above has a full description of the proposal, but the summary is that I would like to propose adding
Element.isRendered()
function to detect whether an element is rendered. Specifically, if it isdisplay: none
or in such a subtree, or in a subtree of acontent-visibility: hidden
element, thenisRendered()
on that element would return false. Otherwise it would return true(please see the other issue for discussions of whether things like images that haven't loaded be unrendered as well).
The text was updated successfully, but these errors were encountered: