Skip to content

Correctly calculate comment preview size#154

Open
samhed wants to merge 1 commit intobugzilla:5.2from
samhed:patch-1
Open

Correctly calculate comment preview size#154
samhed wants to merge 1 commit intobugzilla:5.2from
samhed:patch-1

Conversation

@samhed
Copy link
Copy Markdown

@samhed samhed commented Oct 4, 2023

Details

Instead of trying to guess in the JavaScript what the padding difference is, this PR suggests retrieving it using getComputedStyle(). The hard-coded assumption of 4px was wrong. Furthermore, it can break even more for custom CSS themes.

Additional info

Patch applied in Cendio's bugzilla for ThinLinc here (note that the specific bug isn't relevant, it is just an example):
https://bugzilla.cendio.com/show_bug.cgi?id=7867

Test Plan

  1. Open the show_bug view
  2. Start writing a new comment
  3. Press the preview tab above the comment textarea
  4. Observe that (with the patch) the preview box is now the same size as the comment textarea

Instead of trying to guess in the JavaScript what the padding difference is, we can retrieve it using getComputedStyle. The hard-coded assumption of 4px was wrong. Furthermore, it can break even more for custom CSS themes.
@justdave
Copy link
Copy Markdown
Member

Is there a bug filed on https://bugzilla.mozilla.org/ to go with this? If not, can you file one and link it here? Thanks!

@samhed
Copy link
Copy Markdown
Author

samhed commented Nov 20, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants