Typescript: focusin/focusout events missing in lib.dom.d.ts

Created on 2 Apr 2019  路  9Comments  路  Source: microsoft/TypeScript

In contrast to issue #21822, focusin and focusout are missing as event types for element.addEventListener().

TypeScript Version: 3.3.4000

Search Terms:

focusin focusout

Code

image

image

Expected behavior:

Both, focusin and focusout, should be available, taking an FocusEvent as their parameter.

Actual behavior:

Both, focusin and focusout, are unknown to TypeScript.

Related Issues:

21822

Bug lib.d.ts

Most helpful comment

Ah, great! Thanks for clarifying!

All 9 comments

Hi! Yep, it seems they are missing!
I can contribute to this one, will submit a PR soon.

Should onfocusin and onfocusout be also included as properties of the interface GlobalEventHandlers? e.g.:

onfocusin: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
onfocusout: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;

Created a PR, still kind of WIP, so I'd be glad to get some feedback!

Just for information here, the PR should be good to be merged now.

@RyanCavanaugh sorry to nag again, but the PR has been open for a month and it's approved, but not yet merged. Is something still missing?

@Fabianopb : Just out of curiosity: In the PR @saschanaz writes: "those IDL attributes are not implemented in any browsers nor included in any spec."

But, in fact ...

  • they are implemented in all common browsers, incl. Firefox, Chrome and IE 11
  • they are listed in this W3C UI Events spec.

Have I been missing something?

And, most importantly, are these two events now added to the lib?

@SetTrend By "those IDL attributes" I meant on* IDL attributes including onfocusin and onfocusout. They are not in the spec nor implemented anywhere, although I filed https://github.com/whatwg/html/issues/4542 to add them.

Yes, @saschanaz is right. But anyway focusin and focusout are now added and merged to master, I dunno when the patch will be released though.

Ah, great! Thanks for clarifying!

Was this page helpful?
0 / 5 - 0 ratings