Skip to content

Resize Observer spec and Blink's implementation disagree on what happens when the writing-mode changes #3887

Open
@dholbert

Description

@dholbert

The ResizeObserver isActive check (to answer "was there a resize") is defined here:
https://drafts.csswg.org/resize-observer/#dom-resizeobservation-isactive
...and right now, it says Return true if currentSize is not equal to this.lastReportedSize. (where each size is basically an inlineSize, blockSize coordinate pair.

Right now, the spec text doesn't explain how to handle the possibility that currentSize and lastReportedSize may have different writing modes. So implicitly, this would suggest that the writing-mode could change and no notification would be fired as long as "old inlineSize" == "new inlineSize". But this disagrees with what Chrome's implementation does in this circumstance.

This needs to be clarified & either Chrome or the spec need to be fixed to agree.

Here's a live example that demonstrates that Chrome disagrees with the spec:
https://jsfiddle.net/dholbert/ce094nxj/

Basically:

  • there are two 300x200 divs, whose writing-mode changes when you hover them.
  • the first one's physical dimensions never change (which means its inline-size and block-size change whenever its hovered).
  • the second one's logical dimensions never change (i.e. its inline-size and block-size are static regardless of writing-mode, and its height/width are swapped when hovered).

According to the spec, the observer must fire when I hover the first div, and it must not fire when I hover the second div. But Chrome's implementation does the opposite of this.

I don't have particularly strong feelings about which behavior is best, but this will influence our implementation strategy in Firefox so I want to try to get it right up front. @atotic, what do you think we should do here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions