-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Labels
Description
def scrollIntoView(top: Boolean = js.native): Unit = js.native |
From lib.dom.d.ts:
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
interface ScrollIntoViewOptions extends ScrollOptions {
block?: ScrollLogicalPosition;
inline?: ScrollLogicalPosition;
}
interface ScrollOptions {
behavior?: ScrollBehavior;
}
type ScrollBehavior = "auto" | "smooth";
type ScrollLogicalPosition = "center" | "end" | "nearest" | "start";
In particular, it would be great not to have to write
div.asInstanceOf[js.Dynamic].scrollIntoView(js.Dynamic.literal(block = "nearest")).asInstanceOf[Unit]
More broadly how is this repo kept in sync with browser APIs? Can ScalablyTyped help somehow?
raquo
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
sjrd commentedon Jun 19, 2020
By PRs from users who notice that something's not up to date.
ScalablyTyped focuses on applications by design. It's not designed for libraries that everyone depends on, such as the DOM.
oyvindberg commentedon Jun 19, 2020
I'll just mention in passing that the Typescript DOM definitions are 1) up to date for every TS release, 2) very detailed, 3) tagged by which standard (es5, esnext, etc) things were defined in. ST takes all this and massages it into Scala.js through a series of rewrites. If there is interest nothing in theory stops us from writing a custom conversion script which would "sync" all/some of it here.
In the mean time it's easy to copy/paste and adapt code as necessary @nafg :)
armanbilge commentedon Aug 11, 2021
@nafg would you mind making a PR? would be much appreciated!! :)
armanbilge commentedon Aug 11, 2021
Sounds very appealing ... maybe one day :)
nafg commentedon Jun 13, 2023
Sorry I never made a PR. For now here is the code I use in my project. Maybe it will be easy for a maintainer to adapt it into the codebase. Otherwise maybe I can do it in the next few days (but I may need a reminder).
The obvious change that needs to be made is replacing the object apply method and its implementation with changing the signature of the existing method. I guess
blockNearest
is an arbitrary convenience object for my own use so it should be discarded. That leaves theOptions
trait.I'm just going through utility code in my application codebase. I haven't looked up the DOM docs so it might be missing other things.