Repository navigation
Conversation
commit: |
natemoo-re
left a comment
There was a problem hiding this comment.
just some suggestions! shaping up nicely
| this.notify = notify; | ||
| this.documentElement = this.createElement('html'); | ||
| this.body = this.createElement('body'); | ||
| this.body = this.createElement('body') as HTMLBodyElement; |
There was a problem hiding this comment.
I wonder if we could type createElement to return the correct type?
There was a problem hiding this comment.
Yes, we definitely could. It's going to be really handy when we start making JSX integrations, especially with custom elements.
I'm a bit at a loss as to the best way to do it now however. I mean, there are a couple ways we could go about it, but I do worry that a solution invested in now, might just get in the way of our ultimate solution.
I agree that it's something we should do though. If we can record it somewhere, is a follow-on ok?
| if (!this.isConnected) { | ||
| return; | ||
| } | ||
| this.ownerDocument._setActiveElement(this); |
There was a problem hiding this comment.
interesting! do you know how the browser handles privileged methods like this?maybe this could be a local function that stores state per document in a WeakMap or something? there's probably a nicer way than that, just the first thing that came to mind.
There was a problem hiding this comment.
Yeah, we could do it that way. It would certainly make it so that don't have a "rogue" public method that someone could invoke on their own.
| } | ||
|
|
||
| get activeElement(): Element { | ||
| return this.#activeElement ?? this.body; |
There was a problem hiding this comment.
body is the default activeElement? TIL!
What does this PR do?
Implement explicitly focusing and blurring and the according event dispatch. This is a prerequisite for events moving focus around.
Type of change
Checklist
pnpm test)pnpm format)AI-generated code disclosure