basecamp / basecamp/trix

file input click event breaks UI

Open
#1,039 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
20k
Forks
1.1k
Avg merge
3d 12h
Merged PRs (30d)
13

Description

I have a Trix editor sitting in a dialog modal. The dialog is configured to close when a user clicks outside of the dialog content. When a user clicks the "Attach Files" button in the Trix toolbar, my dialog closes.

[Looking at the Trix file input config](https://github.com/basecamp/trix/blob/main/src/trix/config/input.js#L23-L24), it appears that clicking "Attach Files" appends an `` to the DOM `` and then triggers a `click` on the input, thus causing my dialog to close.

If the `` were instead inserted as a sibling of the `` element my modal wouldn't break. Alternatively, if the Trix file input config could allow for changing where the `` element is inserted into the DOM that would provide a solution to my issue as well.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/trix/config/input.js lines 23-24, where the file input is appended and clicked. Trace how the Attach Files toolbar action uses this configuration, then determine whether the input should be placed beside the trix-editor element or expose a configurable insertion point. Done means the modal remains open when Attach Files is clicked and existing file attachment behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.