Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions resources/js/components/fieldtypes/bard/Image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,5 @@ export default {
this.closeEditor();
},
},
updated() {
// This is a workaround to avoid Firefox's inability to select inputs/textareas when the
// parent element is set to draggable: https://bugzilla.mozilla.org/show_bug.cgi?id=739071
this.$el.setAttribute('draggable', false);
},
};
</script>
17 changes: 15 additions & 2 deletions resources/js/components/fieldtypes/bard/Set.vue
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,25 @@ export default {
);

reveal.mount(this.$refs.container, this.expand);

// Firefox bug 739071: text selection doesn't work inside elements with a
// draggable ancestor. ProseMirror sets draggable=true on the node-view-wrapper
// because the Set node spec has draggable:true. We must keep it false.
this.$el.setAttribute('draggable', false);
this._draggableObserver = new MutationObserver(() => {
if (this.$el.getAttribute('draggable') !== 'false') {
this.$el.setAttribute('draggable', false);
}
});
this._draggableObserver.observe(this.$el, { attributes: true, attributeFilter: ['draggable'] });
},

updated() {
// This is a workaround to avoid Firefox's inability to select inputs/textareas when the
// parent element is set to draggable: https://bugzilla.mozilla.org/show_bug.cgi?id=739071
this.$el.setAttribute('draggable', false);
},
Comment on lines 346 to 348
Copy link
Member

Choose a reason for hiding this comment

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

I think the setAttribute in updated is redundant now?


beforeUnmount() {
this._draggableObserver?.disconnect();
},
};
</script>