Skip to content

Fix the gh-pages demo for Firefox #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 17, 2025
Merged

Conversation

ExplodingCabbage
Copy link
Collaborator

Two things were broken:

  1. Newlines rendered as massive page breaks instead of newlines, because Firefox creates <div> elements within the contenteditable to represent newlines and our CSS was making them height: 100%.
  2. We weren't reading the typed content from the editable divs correctly, because you can't just use textContent or innerText for that - see e.g. https://stackoverflow.com/q/64105609/1709587 and https://stephenhaney.com/2020/get-contenteditable-plaintext-with-correct-linebreaks/

Point 1 is easy to fix, though I worry slightly that some browsers might do really eccentric things (and I don't have a Mac to test Safari). Point 2, there are fixes available (see Stephen Haney's post, or https://stackoverflow.com/a/15349136/1709587) but they're kinda hacky and make me nervous.

Fortunately I don't think we need to use either of those hacks nor do anything clever to fix this, because we can simply replace the contenteditable div with a textarea. We never needed any functionality more complicated than what a textarea provides in the first place!

Fixes #575

@ExplodingCabbage ExplodingCabbage merged commit f631357 into gh-pages Feb 17, 2025
@ExplodingCabbage ExplodingCabbage deleted the fix-for-firefox branch February 17, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant