A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Center enumeration value for scrollLogicalPosition

blago
2015-06-30

Currently ScrollLogicalPosition enumearation accepts 2 values: "start" & "end"

enum ScrollLogicalPosition { "start", "end" };

It seems good to me to add "center" value also, so that content can be centered in the viewport or inside scrolling box ? This can be done with non-standard scrollIntoViewIfNeeded(true) but this option with passing objects is much cleaner to me.

Example:

document.body.children[19].scrollIntoView({
    behavior: "smooth",
    block: "center"
});

Firefox supports this but only with "start" & "end" values.

stuartpb
2015-07-19

Might want to note that you’re referring to ScrollLogicalPosition as defined in http://drafts.csswg.org/cssom-view/#enumdef-scrolllogicalposition