Skip to content

Commit

Permalink
Allow forms inside ResourceItems
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillplatonov committed Aug 16, 2021
1 parent c858c91 commit 8e69fd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/polaris.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ function _defineProperty(obj, key, value) {

class _class$2 extends Controller {
open(event) {
if (this.hasLinkTarget && this.targetIsNotLink(event.target)) {
if (this.hasLinkTarget && this.targetNotClickable(event.target)) {
this.linkTarget.click();
}
}
targetIsNotLink(element) {
return !element.closest("a") && !element.closest("button");
targetNotClickable(element) {
return !element.closest("a") && !element.closest("button") && element.nodeName !== "INPUT";
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/javascript/polaris/resource_item_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ export default class extends Controller {
static targets = ['link']

open(event) {
if (this.hasLinkTarget && this.targetIsNotLink(event.target)) {
if (this.hasLinkTarget && this.targetNotClickable(event.target)) {
this.linkTarget.click()
}
}

targetIsNotLink(element) {
return !element.closest('a') && !element.closest('button')
targetNotClickable(element) {
return !element.closest('a') && !element.closest('button') && element.nodeName !== "INPUT"
}
}

0 comments on commit 8e69fd4

Please sign in to comment.