Open Bug 1261296 Opened 8 years ago Updated 1 year ago

Click handlers are not triggered at all on checkbox inputs in a block with contenteditable="true"

Categories

(Core :: DOM: Editor, defect)

45 Branch
defect

Tracking

()

Webcompat Priority P3

People

(Reporter: remi, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [h2review-noted])

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160304114926

Steps to reproduce:

Make the following HTML site:

in `index.html`

    <div contenteditable="true">

      <h1 id="h1">test checkbox click</h1>

      <input type="checkbox">

      <br>

      <label>
        mybox1
        <input type="checkbox" name="mybox">
      </label>

      <br>

      <label for="mybox2">
        mybox2
        <input type="checkbox" id="mybox2">
      </label>
    </div>

    <script type="text/javascript">
      document.getElementById('mybox2').addEventListener('click',function(evt){
        console.log(evt);
        alert('click on mybox2');
      });
      document.getElementById('h1').addEventListener('click',function(evt){
        console.log(evt);
        alert('click on h1');
      });
    </script>

> NB: Note the two discussions on github projects:
> - https://github.com/sirap-group/tinymce-plugin-forminputs/issues/7
> - https://github.com/tinymce/tinymce/issues/2817



Actual results:

And the result is that:

-  the checkboxes are not checkable on click (we said me its wanted).
-  AND the `h1` click handler is called on click on `h1` tag
-  BUT the `mybox2` click handler is never called on click on `mybox2` input


Expected results:

The click on the `mybox2` input should call the click handler.

Notice that other events like `mouseover` are correctly fired on input.
Summary: Click handlers are not triggerd at all on checkbox inputs in a block with contenteditable="false" → Click handlers are not triggered at all on checkbox inputs in a block with contenteditable="true"
Component: Untriaged → Event Handling
Component: Event Handling → Editor
I can confirm this issue. We see it with tinymce with their contenteditable area. Checkboxes cannot be checked in Firefox but this does work in Chrome, Safari, IE, etc. Has any work been done on this? Is it prioritized inside Mozilla? Any feedback is appreciated as we want our users to be able to use any browser when editing documents.

Thanks.
Brett
Flags: needinfo?(m_kato)
Flags: needinfo?(m_kato)
Attached file Test case (deleted) —
(In reply to brett from comment #1)
> I can confirm this issue. We see it with tinymce with their contenteditable
> area. Checkboxes cannot be checked in Firefox but this does work in Chrome,
> Safari, IE, etc. Has any work been done on this? Is it prioritized inside
> Mozilla? Any feedback is appreciated as we want our users to be able to use
> any browser when editing documents.

This isn't regression of recent release, so this is marked as P3.
Flags: needinfo?(m_kato)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Since StyleUserInfo is None, event is disabled into HTMLInputElement.  It means that HTMLInputElement::IsDisabledForEvents return true on this sample.
Thanks Makoto-san. So is this scheduled for a release? Just wondering what kind of a timeframe to expect.
Hi, smaug.

When using attached test case, Gecko cannot turn on checkbox since this is contenteditable.  But other browsers (Edge, Safari and Chrome) allows that checkbox / radio can turned on / turned off by click even if contenteditable.

Actually, we set "-moz-user-input: none !important;" for radio and checkbox in layout/style/contenteditable.css.  Do you know a issue when removing "-moz-user-input" for radio and checkbox in contenteditable?
Flags: needinfo?(bugs)
I don't know. I'd need to look at the blame. It is possible that the behavior just has been that forever, maybe even since netscape era.
Flags: needinfo?(bugs)
Whiteboard: [h2review-noted]
Severity: normal → S3

This bug is 6 years old. As far as I can tell, a checkbox in a contenteditable not only doesn't click; it eats events. Clicking on other clickable things in a contenteditable seems to work. That seems to mean that, in Firefox, no richtext editors can have checkboxes - at least not ones that are rendered natively. Gross.

Webcompat Priority: --- → ?
Webcompat Priority: ? → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: