Closed Bug 1554965 Opened 5 years ago Closed 5 years ago

<input type="date"> input event should be composed

Categories

(Core :: DOM: Core & HTML, defect, P3)

67 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: web, Assigned: edgar)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Please see this glitch: https://glitch.com/edit/#!/clever-macaw?path=index.html:67:14

Select a date from the 'inner' input. The resulting input event's composed property should be true, instead it is false.

EXPECTED : <input type="date"> input events should be composed
ACTUAL: those events have composed: false

Source for linked glitch is shown below:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Hello!</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <!-- import the webpage's stylesheet -->
    <link rel="stylesheet" href="/style.css">
    
    <!-- import the webpage's javascript file -->
    <script type="module">
      import { LitElement, html } from 'https://unpkg.com/lit-element?module';

      /**
       * Print a debug message to the screen which says
       * - which element the listener was called on
       * - if the event is composed,
       */
      window.print = name => (event) => {
        console.log(name, event);
        const dt = document.createElement('dt');
              dt.textContent = name;
        const dd = document.createElement('dd');
              dd.textContent = `Composed? ${event.composed}`;
        document.querySelector('output dl').appendChild(dt);
        document.querySelector('output dl').appendChild(dd);
      }

      /**
       * Define an element with a date input in it's shadow root
       */
      customElements.define('buggy-input', class extends LitElement {
        render() {
          return html`
            <label>
              Inner Input
              <input id="inner" type="date" @input="${print('inner')}"></input>
            </label>
          `;
        }
      });
      
      /**
       * listen for input events on a control input and the custom el (composed)
       */
      document.getElementById('light').addEventListener('input', print('light'))
      document.querySelector('buggy-input').addEventListener('input', print('outer'))
    </script>
  </head>  
  <body>
    <h1>Hi there!</h1>
    
    <buggy-input></buggy-input>
    
    <hr/>
    
    <label>
      Light Input
      <input id="light" type="date" oninput="print('light')"/>
    </label>
    
    <hr/>
    
    <h2>
      Results:
    </h2>
    <output><dl></dl></output>

  </body>
</html>
Component: General → DOM: Core & HTML
Product: Firefox → Core
Blocks: shadowdom
Priority: -- → P3
Assignee: nobody → echen
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

I'm interested in trying to write a patch for this. It looks to me like https://searchfox.org/mozilla-central/source/dom/html/HTMLInputElement.cpp#256 is a relevant line. I couldn't find the place where the input event specifically is fired, though.

Some background: in my day job I build node and web. I've contributed to a C codebase before, but have no experience with cpp. This would be my first browser contribution and my first mozilla contribution. I've installed arc and moz-phab, and completed bootstrap.py.

If you're amenable to acting as my mentor through this process, I'd love that. Alternately, if you're already most of the way through the patch I'd love to see the changes for my own edification.

Thank you!

Flags: needinfo?(echen)

(sorry for the slow response)

I don't have a patch at this moment, free feel to take this bug if you are still interested in working on this bug, I am happy to act as a mentor.
The input event is fired from https://searchfox.org/mozilla-central/rev/b38e3beb658b80e1ed03e0fdf64d225bd4a40327/dom/html/HTMLInputElement.cpp#2200 with EditorInputType::eUnknown and the composed flag of the event isn't set in https://searchfox.org/mozilla-central/rev/b38e3beb658b80e1ed03e0fdf64d225bd4a40327/dom/base/nsContentUtils.cpp#4091-4101.

Flags: needinfo?(echen) → needinfo?(web)
Flags: needinfo?(web)
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c5473827c579
Input event should be composed; r=smaug
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: