Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move beforeinput event and input event from HTMLElement to Element #30288

Merged
merged 15 commits into from Jan 8, 2024

Conversation

skyclouds2001
Copy link
Contributor

@skyclouds2001 skyclouds2001 commented Nov 15, 2023

Description

in UI Events, the beforeinput event and input event has failed link, this is because the two events' documentation is only written under HTMLElement not under Element

and other event types (like mouse events) in the standard that target to element do documented in Element rather then HTMLElement

(also, interstingly, as I check via event handle property (like oninput), they are available on HTMLElement SVGElement or MathMLElement, and Window or Document, but not available on Element, this also happens to other UI Events, this behavior is similar to Pointer Events and Touch Events)

image

also add Element: auxclick and Element: contextmenu into group data of UI Events, see https://w3c.github.io/uievents/

Motivation

Additional details

Related issues and pull requests

@skyclouds2001 skyclouds2001 requested a review from a team as a code owner November 15, 2023 09:47
@skyclouds2001 skyclouds2001 requested review from wbamberg and removed request for a team November 15, 2023 09:47
@github-actions github-actions bot added the Content:WebAPI Web API docs label Nov 15, 2023
Copy link
Contributor

github-actions bot commented Nov 15, 2023

Preview URLs (48 pages)
Flaws (27)

Note! 37 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/HTMLSelectElement
Title: HTMLSelectElement
Flaw count: 10

  • macros:
    • /en-US/docs/Web/API/HTMLSelectElement/length does not exist
    • /en-US/docs/Web/API/HTMLSelectElement/multiple does not exist
    • /en-US/docs/Web/API/HTMLSelectElement/name does not exist
    • /en-US/docs/Web/API/HTMLSelectElement/required does not exist
    • /en-US/docs/Web/API/HTMLSelectElement/size does not exist
    • and 5 more flaws omitted

URL: /en-US/docs/Web/API/PerformanceEventTiming
Title: PerformanceEventTiming
Flaw count: 1

  • macros:
    • /en-US/docs/Web/API/HTMLElement/pointerrawupdate_event does not exist

URL: /en-US/docs/Web/API/Element/beforeinput_event
Title: Element: beforeinput event
Flaw count: 1

  • bad_bcd_queries:
    • No BCD data for query: api.Element.beforeinput_event

URL: /en-US/docs/Web/API/Element/input_event
Title: Element: input event
Flaw count: 1

  • bad_bcd_queries:
    • No BCD data for query: api.Element.input_event

URL: /en-US/docs/Web/API/HTMLElement
Title: HTMLElement
Flaw count: 1

  • macros:
    • /en-US/docs/Web/API/HTMLElement/attributeStyleMap does not exist

URL: /en-US/docs/Web/API/HTML_DOM_API
Title: The HTML DOM API
Flaw count: 5

  • macros:
    • /en-US/docs/Web/API/HTMLDirectoryElement does not exist
    • /en-US/docs/Web/API/HTMLFrameElement does not exist
    • /en-US/docs/Web/API/HTMLIsIndexElement does not exist
    • /en-US/docs/Web/API/External does not exist
    • /en-US/docs/Web/API/ApplicationCache does not exist

URL: /en-US/docs/Web/HTML/Element/input/month
Title: <input type="month">
Flaw count: 2

  • macros:
    • /en-US/docs/Web/API/HTMLInputElement/value does not exist
    • /en-US/docs/Web/API/HTMLInputElement/value does not exist

URL: /en-US/docs/Web/HTML/Element/input/week
Title: <input type="week">
Flaw count: 1

  • macros:
    • /en-US/docs/Web/API/HTMLInputElement/value does not exist

URL: /en-US/docs/Web/HTML/Element/input/password
Title: <input type="password">
Flaw count: 3

  • macros:
    • /en-US/docs/Web/API/HTMLInputElement/selectionStart does not exist
    • /en-US/docs/Web/API/HTMLInputElement/selectionEnd does not exist
    • /en-US/docs/Web/API/HTMLInputElement/selectionDirection does not exist

URL: /en-US/docs/Web/HTML/Element/input/range
Title: <input type="range">
Flaw count: 1

  • macros:
    • /en-US/docs/Web/API/HTMLInputElement/valueAsNumber does not exist

URL: /en-US/docs/Mozilla/Firefox/Releases/14
Title: Firefox 14 for developers
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/JavaScript_code_modules/BookmarkHTMLUtils.jsm
External URLs (1)

URL: /en-US/docs/Web/API/Document/execCommand
Title: Document: execCommand() method

(comment last updated: 2024-01-08 12:11:27)

@skyclouds2001 skyclouds2001 changed the title fix link fix link in UI events Nov 15, 2023
@skyclouds2001 skyclouds2001 requested a review from a team as a code owner November 15, 2023 10:32
@skyclouds2001 skyclouds2001 requested review from bsmth and removed request for a team November 15, 2023 10:32
@bsmth
Copy link
Member

bsmth commented Nov 17, 2023

Thanks @skyclouds2001 - taking a look shortly

@bsmth
Copy link
Member

bsmth commented Nov 17, 2023

Searching through other content brings up these:

- {{domxref("Element/beforeinput_event", "beforeinput")}}
- {{domxref("Element/input_event", "input")}}

Could we fix it in this PR, also? Those are the last ones I can find in other docs.

@skyclouds2001
Copy link
Contributor Author

skyclouds2001 commented Nov 17, 2023

honestly, I check the standard again, and notice that other event types in UI Events spec that say its target can be element, their documentations are written in Element, not HTMLElement

I check these events via event handle property (like oninput), they are available on Window, Document, HTMLElement, SVGElement and MathMLElement, but not available on Element

reference to Touch Events and Pointer Events, their event property handler are defined in GlobalEventHandlers mixin, which expose methods to Window, Document, HTMLElement, SVGElement and MathMLElement

also reference to TypeScript DOM definition file, which defines the GlobalEventHandlers interface reflecting the GlobalEventHandlers mixin in standard

so I guess a better solution is to move input event and beforeinput event from HTMLElement to Element

@skyclouds2001 skyclouds2001 requested a review from a team as a code owner November 20, 2023 03:49
@skyclouds2001 skyclouds2001 changed the title fix link in UI events move beforeinput event and input event from HTMLElement from Element Nov 20, 2023
@skyclouds2001 skyclouds2001 changed the title move beforeinput event and input event from HTMLElement from Element move beforeinput event and input event from HTMLElement to Element Nov 20, 2023
@wbamberg wbamberg removed their request for review November 22, 2023 00:17
@bsmth
Copy link
Member

bsmth commented Nov 27, 2023

a better solution is to move input event and beforeinput event from Element from HTMLElement

From the spec:

Trusted Targets Element (specifically: control types such as HTMLInputElement, etc.) or any Element with contenteditable attribute enabled

This makes sense to me. Note that if we move, it will need to also be moved in BCD:

@queengooborg any thoughts on this?

@queengooborg
Copy link
Collaborator

queengooborg commented Dec 9, 2023

BCD places events based upon where the events are defined in the spec, rather than the event handlers -- so, this change makes sense to me, yes.
Related: mdn/browser-compat-data#19595

Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

Copy link
Contributor

github-actions bot commented Jan 2, 2024

This pull request has merge conflicts that must be resolved before it can be merged.

@chrisdavidmills chrisdavidmills removed their request for review January 2, 2024 16:12
Copy link
Contributor

github-actions bot commented Jan 4, 2024

This pull request has merge conflicts that must be resolved before it can be merged.

@bsmth
Copy link
Member

bsmth commented Jan 8, 2024

Looking great, and I see the corresponding BCD is done, so I think we can merge shortly. Is it correct to say there are some minor leftovers of (HTMLElement/input_event & HTMLElement/beforeinput) in the following two docs:

  • /files/en-us/web/api/document/execcommand/index.md (link)
    • [`beforeinput`](/en-US/docs/Web/API/HTMLElement/beforeinput_event) and [`input`](/en-US/docs/Web/API/HTMLElement/input_event):
  • /files/en-us/web/api/element/beforeinput_event/index.md
    • ... in contrast to the {{domxref("HTMLElement/input_event", "input")}} event,

Copy link
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the BCD has landed in mdn/browser-compat-data#21640, leaving +1 with some comments for flaws that we can fix here. We can merge after cleaning these up if you like

Thank you!

@skyclouds2001
Copy link
Contributor Author

  • HTMLElement/beforeinput_event

fixed!

@bsmth
Copy link
Member

bsmth commented Jan 8, 2024

Looking great, let's merge 🚢

@bsmth bsmth merged commit 72ca3d7 into mdn:main Jan 8, 2024
8 checks passed
@skyclouds2001 skyclouds2001 deleted the ui-events branch January 8, 2024 14:30
yin1999 added a commit to mdn/translated-content that referenced this pull request Jan 9, 2024
yin1999 added a commit to mdn/translated-content that referenced this pull request Jan 9, 2024
* zh-cn: sync translated content

* move beforeinput event and input event from HTMLElement to Element

ref: mdn/content#30288

* Remove mobile guides and redirect to responsive design guide

ref: mdn/content#31540

---------

Co-authored-by: Allo <yin199909@aliyun.com>
estelle pushed a commit to estelle/content that referenced this pull request Jan 9, 2024
…ment` (mdn#30288)

* fix link

* add

* revert·

* move files

* update link

* HTMLElement/input_event to Element/input_event

* update

* fix links

---------

Co-authored-by: Brian Thomas Smith <brian@smith.berlin>
dipikabh pushed a commit to dipikabh/content that referenced this pull request Jan 17, 2024
…ment` (mdn#30288)

* fix link

* add

* revert·

* move files

* update link

* HTMLElement/input_event to Element/input_event

* update

* fix links

---------

Co-authored-by: Brian Thomas Smith <brian@smith.berlin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Accessibility Accessibility docs Content:CSS Cascading Style Sheets docs Content:Firefox Content in the Mozilla/Firefox subtree Content:HTML Hypertext Markup Language docs Content:Learn:Client-side Content under “Client-side JavaScript frameworks” (Svelte, React, Angular, Vue) and related subtrees Content:SVG SVG docs Content:WebAPI Web API docs needs BCD update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants