Fix auto-resizing of BBCode editor text box on Firefox#4
Open
rose-blossom wants to merge 1 commit intof-list:masterfrom
Open
Fix auto-resizing of BBCode editor text box on Firefox#4rose-blossom wants to merge 1 commit intof-list:masterfrom
rose-blossom wants to merge 1 commit intof-list:masterfrom
Conversation
The previous implementation strategy used getComputedStyle().cssText to copy styles from the real textarea onto the fake, invisible one used for computing sizing metrics. This worked alright on Chrome, but not on Firefox, as Firefox currently always returns an empty string for cssText on the result of getComputedStyle() (see Bugzilla #137687). This commit avoids copying the computed styles manually in favor of just applying the same CSS classes to the invisible textarea. It also tweaks the size computation to add the border height to the computed scrollHeight before setting the inline height style, since scrollHeight does not include the border, but box-sizing is set to border-box, and the 2px difference was enough to provoke a scroll bar in Firefox.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous implementation strategy used
getComputedStyle().cssTextto copy styles from the real textarea onto the fake, invisible one used for computing sizing metrics. This worked alright on Chrome, but not on Firefox, as Firefox currently always returns an empty string forcssTexton the result ofgetComputedStyle()(see Bugzilla #137687).This commit avoids copying the computed styles manually in favor of just applying the same CSS classes to the invisible textarea. It also tweaks the size computation to add the border height to the computed
scrollHeightbefore setting the inlineheightstyle, sincescrollHeightdoes not include the border, butbox-sizingis set toborder-box, and the 2px difference was enough to provoke a scroll bar in Firefox.