Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ngAria disables spacebar for contenteditable divs #16761

Closed
1 of 3 tasks
Eblax opened this issue Nov 16, 2018 · 3 comments
Closed
1 of 3 tasks

ngAria disables spacebar for contenteditable divs #16761

Eblax opened this issue Nov 16, 2018 · 3 comments

Comments

@Eblax
Copy link
Contributor

Eblax commented Nov 16, 2018

I'm submitting a ...

  • bug report
  • feature request
  • other

Current behavior:

If you have a div with contenteditable="true" and this div has an ancestor with an ng-click directive, and ngAria is being used, pressing spacebar does nothing when editing inside the contenteditable div.

Expected / new behavior:

Pressing the spacebar should result in a space being entered in the text.

Minimal reproduction of the problem with instructions:

  • Include ngAria
  • Put ng-click on a div
  • Put contenteditable="true" on a div inside this div
  • See that pressing the spacebar when editing text in this div does nothing
    http://plnkr.co/edit/CqMNGYzinoYy8o3HawPw

AngularJS version: 1.7.5

Browser: [Chrome 71 | Firefox 63]

Anything else:

I fixed this by adding a check if element has "isContentEditable" property before blocking spacebar.

@petebacondarwin
Copy link
Contributor

Is this a result of fixing #16664? by #16680?

@gkalpak
Copy link
Member

gkalpak commented Nov 16, 2018

It is more like #16680 didn't entirely fix the issue caused by 6c224a2. So, if you have an ngClick handler on a contenteditable element (that is not an input/select/textarea/button), then spacebar will not work correctly.

Work-arounds:

  • Use ngKeydown/ngKeypress/ngKeyup on the same element (and set it to an non-empty value).
  • Use ng-on-click instead of ng-click (if you are are on latest 1.7.x).

If we wanted to fix it, it probably makes sense to also exclude [contenteditable] elements from this behavior of preventing spacebar.
EDIT: Essentially, what #16762 does - I just saw it 😁

@Narretz
Copy link
Contributor

Narretz commented Dec 5, 2018

Fixed by #16762

@Narretz Narretz closed this as completed Dec 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants