-
Notifications
You must be signed in to change notification settings - Fork 842
Forms: Fix dark theme outline form #45984
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
Open
enejb
wants to merge
7
commits into
trunk
Choose a base branch
from
fix/darktheme-outline-form
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+73
−21
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1d65bbe
Calculate the form background color correctly
enejb b6ddc58
Update css to use the correct form background color as expected.
enejb f0d1773
Minor fixes to the international form field
enejb a2ffa35
Fix outline form when border size is set to 0 by default
enejb 388e1c2
Make sure that the input text colour is set to something that is visi…
enejb ace640a
changelog
enejb 701c4b1
Allow form input to overwrite the input color!
enejb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: fixed | ||
|
|
||
| Forms: Improve dark theme compatibility and outline form style |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,6 @@ window.jetpackForms.generateStyleVariables = function ( formNode ) { | |
| } | ||
|
|
||
| const _document = window[ 'editor-canvas' ] ? window[ 'editor-canvas' ].document : document; | ||
| const bodyNode = _document.querySelector( 'body' ); | ||
|
|
||
| const styleProbe = _document.createElement( 'div' ); | ||
| styleProbe.className = STYLE_PROBE_CLASS; | ||
|
|
@@ -90,7 +89,7 @@ window.jetpackForms.generateStyleVariables = function ( formNode ) { | |
| const buttonOutlineNode = styleProbe.querySelector( '.btn-outline' ); | ||
| const inputNode = styleProbe.querySelector( 'input[type="text"]' ); | ||
|
|
||
| const backgroundColor = window.jetpackForms.getBackgroundColor( bodyNode ); | ||
| const backgroundColor = window.jetpackForms.getBackgroundColor( formRootNode ); | ||
| const inputBackgroundFallback = window.jetpackForms.getBackgroundColor( inputNode ); | ||
| const inputBackground = window.getComputedStyle( inputNode ).backgroundColor; | ||
| const bodyTextColor = window.getComputedStyle( formRootNode ).color; | ||
|
|
@@ -132,6 +131,9 @@ window.jetpackForms.generateStyleVariables = function ( formNode ) { | |
| backdropFilter: inputBackdropFilter, | ||
| } = window.getComputedStyle( inputNode ); | ||
|
|
||
| const borderWidthOutline = | ||
| ( parseFloat( borderWidth ) > 1 ? parseFloat( borderWidth ) : 1 ) + 'px'; | ||
|
|
||
| styleProbe.remove(); | ||
|
|
||
| return { | ||
|
|
@@ -143,6 +145,7 @@ window.jetpackForms.generateStyleVariables = function ( formNode ) { | |
| '--jetpack--contact-form--border': border, | ||
| '--jetpack--contact-form--border-color': borderColor, | ||
| '--jetpack--contact-form--border-size': borderWidth, | ||
| '--jetpack--contact-form--border-size-outline': borderWidthOutline, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is meant to be a fallback for Outlined style I'd say let's use the same wording "outlined" (specially since |
||
| '--jetpack--contact-form--border-style': borderStyle, | ||
| '--jetpack--contact-form--border-radius': borderRadius, | ||
| '--jetpack--contact-form--input-background': inputBackground, | ||
|
|
||
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
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
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
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
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
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/fix-darktheme-outline-form
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: bugfix | ||
|
|
||
| Forms: Improve dark theme vomatibility and outline form style |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need this var? By its definition and usage (if I'm not mistaken) we could use
border-width: max( var( --jetpack--contact-form--border-size, 0 ), '1px' );instead.Would be good to test this with strange values though.