-
Notifications
You must be signed in to change notification settings - Fork 34
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
Address Styling Issues on Entry (Edit/New) and Style Pages #1986
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces modifications to two CSS files: Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (2)
css/custom_theme.css.php (2)
Line range hint
4-4
: Reminder: Address the TODO comment.The TODO comment indicates that tests are missing for this function. Please ensure that the additional parameter change is thoroughly tested to confirm that it behaves as expected.
Do you want me to generate the unit testing code or open a GitHub issue to track this task?
Line range hint
12-24
: Consider adjusting the fee structure or discount policy.The implementation of a flat $20 fee on discounted bills could negate the benefit of the discount, especially for smaller purchases or marginal loyalty tiers. This might lead to customer dissatisfaction, as the intent to reward loyalty paradoxically increases the bill.
Consider revising either the discount percentages or the flat fee application to better align with customer incentives.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- css/custom_theme.css.php (3 hunks)
- css/frm_admin.css (5 hunks)
Additional comments not posted (5)
css/custom_theme.css.php (1)
Line range hint
1-2
: LGTM!The function logic is correct, and the implementation is accurate.
css/frm_admin.css (4)
1409-1410
: Looks good!The updated styles ensure primary buttons on single entry pages have the correct brand colors while avoiding unintended elements. This improves consistency with the overall admin UI.
1471-1472
: Hover styles look good.The updated hover styles for secondary buttons within
.frm-white-body
provide visual feedback and maintain consistency. Excluding.frm-fields-item
is a good call to prevent unintended styling.
3824-3838
: Checkbox styles are consistent.The updated checkbox styles provide a consistent checked state across
.frm-white-body
and.frm_wrap
using thevar(--primary-500)
color. The custom checkmark icon is a nice touch to enhance the visual styling.
8245-8268
: Focus styles are properly scoped.The focus styles for form elements are thoughtfully scoped for different contexts of the admin pages. Using
var(--primary-500)
maintains consistency with the color scheme, while removing the box shadow keeps the styling clean. The!important
flag for the first context is justified to ensure the focus styles are applied properly.
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.
Actionable comments posted: 5
Outside diff range and nitpick comments (5)
css/custom_theme.css.php (1)
903-904
: LGTM: Proper styling for checked, non-disabled checkboxes.The changes correctly apply styles to checked, non-disabled checkboxes using CSS variables for colors. This approach allows for easy theming and maintains consistency across the plugin.
Consider combining these selectors to reduce code duplication:
.frm_forms.with_frm_style .frm_fields_container .frm_checkbox input[type=checkbox]:not([disabled]):checked, .frm_forms .with_frm_style .frm_fields_container .frm_checkbox input[type=checkbox]:not([disabled]):checked { border-color: var(--border-color-active) !important; background-color: var(--border-color-active) !important; }Also applies to: 908-909
css/frm_admin.css (4)
1409-1409
: Consider using a more specific selector for this rule.The selector
.frm_single_entry_page .button-primary:not(.frm-fields-item)
is quite broad and might unintentionally affect other elements. Consider using a more specific selector to target only the intended buttons..frm_single_entry_page .frm-specific-button-class:not(.frm-fields-item) { background-color: var(--primary-500) !important; color: #fff !important; }
Line range hint
1471-1475
: Simplify selector and consider removing!important
.The selector for this rule is overly specific and uses
!important
, which can lead to specificity issues. Consider simplifying it and removing!important
if possible..frm-white-body .button-secondary:not(.frm-fields-item):hover, .frm-white-body .tablenav .button:hover, .frm_wrap .preview > .button:hover { border-color: var(--grey-300); color: var(--grey-800); background: var(--grey-50); box-shadow: none; outline: none; }
Line range hint
3829-3841
: Optimize SVG data URI.The SVG data URI used for the checkbox checked state is quite long. Consider optimizing it for better performance.
You can use an SVG optimization tool to reduce the size of the SVG code. Here's an example of how it might look after optimization:
.frm-white-body input[type="checkbox"]:checked::before, .frm_wrap input[type="checkbox"]:checked::before { content: ''; display: block; width: 100%; height: 100%; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 9'%3E%3Cpath d='M10.6667 1.5L4.25001 7.91667L1.33334 5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-size: 9px; background-repeat: no-repeat; background-position: center; margin: 0; }
Line range hint
4486-4492
: Consider using CSS custom properties for better maintainability.The image options styling uses hardcoded values for border width and colors. Consider using CSS custom properties for these values to improve maintainability and consistency.
body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) .frm_image_options .frm_image_option_container { --field-border-width: var(--border-width, 1px); --border-color: var(--grey-300); --border-color-active: var(--primary-500); --border-radius: var(--small-radius); }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- css/custom_theme.css.php (3 hunks)
- css/frm_admin.css (5 hunks)
Additional comments not posted (2)
css/custom_theme.css.php (2)
908-909
: Duplicate of previous comment.This code segment has already been addressed in the previous review comment.
350-350
: Duplicate of previous comment.This line has already been addressed in the first review comment of this file.
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (4)
css/frm_admin.css (4)
1414-1417
: Minimize the use of!important
declarationsThe use of
!important
can make the CSS harder to maintain and override. Consider increasing the specificity of your selectors or restructuring the CSS to avoid using!important
where possible.
Line range hint
1476-1480
: Simplify selectors and reduce!important
usageThe selectors
.wp-core-ui.frm-white-body .button-secondary:not(.frm-button-entry-nav):hover
and.frm_wrap .preview > .button:hover
are quite specific, and the use of multiple!important
declarations may be unnecessary. Simplifying the selectors and removing!important
can improve maintainability.
8242-8247
: Remove redundant stylesThe focus styles for
.wp-admin .frm_fields_container
elements may be redundant if they are already covered by previous selectors. Review these styles to ensure they are necessary and eliminate any duplication.
Based on the collected information, I can now provide a final response about the checkbox accessibility:
Custom checkbox styling needs accessibility improvements
The current implementation has some accessibility gaps that should be addressed:
- The checkboxes have basic focus styles (border-color change) but lack sufficient visual feedback for hover states
- No ARIA attributes are being used to enhance screen reader experience
- The implementation relies solely on native checkbox behavior without additional keyboard interaction enhancements
To improve accessibility:
- Add distinct hover states for better visual feedback
- Include appropriate ARIA attributes (aria-checked, aria-label) when needed
- Ensure the contrast ratio meets WCAG standards for the checkmark color against the background
- Consider adding explicit focus styles that match your design system's focus indicators
🔗 Analysis chain
Line range hint
3868-3877
: Ensure accessibility for custom checkbox stylingWhen styling checkboxes with pseudo-elements, ensure that their accessibility is not compromised. Verify that the custom checkboxes remain operable via keyboard navigation and are correctly identified by screen readers.
Run the following script to check for accessibility attributes:
Let me gather more information about the checkbox implementation to ensure we have a complete picture of the accessibility considerations.
Let me gather more information about the checkbox implementation, particularly focusing on the HTML structure and keyboard accessibility.
Let me check for any focus and hover styles to ensure the visual feedback is properly implemented.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for custom checkbox inputs and verify accessibility attributes # Find custom checkbox styles rg 'input\[type="checkbox"\]:checked::before' -A 5 # Check for ARIA attributes or roles associated with checkboxes rg 'input\[type="checkbox"\]' -A 3 | rg 'aria-checked|role="checkbox"'Length of output: 1144
Script:
#!/bin/bash # Search for checkbox-related HTML and JavaScript implementations # Look for keyboard event handlers rg -t js 'keydown|keypress|keyup.*checkbox' -A 3 # Search for checkbox-related ARIA attributes in JavaScript rg -t js 'setAttribute.*(?:role|aria).*checkbox' -A 3 # Look for checkbox-related HTML templates or components rg -t php 'input.*type=.checkbox.' -A 3 # Check for any tabindex attributes related to checkboxes rg 'tabindex.*checkbox|checkbox.*tabindex' -A 3Length of output: 110278
Script:
#!/bin/bash # Look for checkbox input elements in PHP files to understand the HTML structure rg -t php '<input[^>]*checkbox[^>]*>' -A 2 # Search for any role attributes on checkbox containers rg -t php 'role=.(checkbox|presentation).' -A 2 # Look for any keyboard event handlers specifically for checkboxes rg -t js 'keydown.*checkbox|keyup.*checkbox|keypress.*checkbox' -B 2 -A 2 # Check for any focus-related styles for checkboxes rg -t css ':focus.*checkbox|checkbox.*:focus'Length of output: 14211
Script:
#!/bin/bash # Search for checkbox-related styles including focus, hover states rg -t css 'input\[type="checkbox"\].*(:hover|:focus)|checkbox.*(:hover|:focus)' -B 1 -A 3 # Look for any checkbox-related ARIA attributes in PHP templates rg -t php 'aria-label.*checkbox|aria-labelledby.*checkbox|aria-describedby.*checkbox' # Check for any explicit tabindex attributes on checkboxes rg -t php 'tabindex.*input.*checkbox|checkbox.*tabindex'Length of output: 488
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
css/custom_theme.css.php
(2 hunks)css/frm_admin.css
(5 hunks)
🔇 Additional comments (3)
css/custom_theme.css.php (2)
874-875
: Previously flagged: Reconsider use of !important
for border-radius
This issue was previously identified. The use of !important
for border-radius may cause maintenance difficulties. Consider increasing selector specificity instead.
903-904
: Verify selector changes against revert commit
The selectors still include .frm_forms
despite a previous commit "Revert the addition of the '.frm_forms' class". This increased specificity could limit styling flexibility, as noted in previous discussions:
"with_frm_style should be safe to apply to any element, not just a frm_forms element"
Let's verify the status of these changes:
Also applies to: 908-909
css/frm_admin.css (1)
8228-8237
: 🛠️ Refactor suggestion
Refactor complex selectors for better maintainability
The selectors targeting focused inputs and textareas are quite complex due to the multiple :not()
pseudo-classes. Simplifying these selectors can enhance readability and maintainability.
Consider simplifying the selectors as follows:
-.frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) textarea:focus,
-.frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) input:focus,
-.frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) select:focus,
-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) .frm_wrap input:focus,
-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) .frm_wrap select:focus,
-.wp-core-ui:not(.frm-admin-page-styles):not(.frm-admin-page-entries) .frm_wrap select:focus,
-#frm-form-templates-modal select:focus,
-.frm-btn-group .multiselect.dropdown-toggle:focus,
-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) .frm_wrap textarea:focus {
+ .frm-white-body textarea:focus,
+ .frm-white-body input:focus,
+ .frm-white-body select:focus,
+ .frm_wrap input:focus,
+ .frm_wrap select:focus,
+ .frm_wrap textarea:focus,
+ .frm-btn-group .multiselect.dropdown-toggle:focus,
+ #frm-form-templates-modal select:focus {
border-color: var(--primary-500) !important;
box-shadow: none !important;
}
Likely invalid or redundant comment.
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
css/frm_admin.css (2)
1414-1414
: Consolidate button styling rulesThe button styling rules are scattered and could be consolidated for better maintainability.
Consider combining these related button styles into a single rule block:
- .frm_single_entry_page #frm-publishing .button-primary { - background-color: var(--primary-500) !important; - color: #fff !important; - } - .wp-core-ui.frm-white-body .button-secondary:not(.frm-button-entry-nav):hover { - border-color: var(--grey-300) !important; - color: var(--grey-800); - background: var(--grey-50) !important; - box-shadow: none !important; - outline: none !important; - } + /* Button styles */ + .frm-button { + background-color: var(--primary-500); + color: #fff; + } + + .frm-button:hover { + border-color: var(--grey-300); + color: var(--grey-800); + background: var(--grey-50); + box-shadow: none; + outline: none; + }Also applies to: 1476-1476
4522-4522
: Improve image option container styling specificityThe image option container styling uses a complex selector with multiple negations.
Consider simplifying the selector and using CSS custom properties more effectively:
- body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) .frm_image_options .frm_image_option_container { + .frm_image_options .frm_image_option_container { --field-border-width: 1px; --border-color: var(--grey-300); --border-color-active: var(--primary-500); --border-radius: var(--small-radius); }
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.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
css/frm_admin.css
(4 hunks)
🔇 Additional comments (2)
css/frm_admin.css (2)
1414-1414
: LGTM! Styling for form entry page submit button
The styling ensures consistent appearance of the submit button on the single entry page.
4522-4522
: LGTM! Image option container styling
The styling ensures consistent appearance of image options in the form builder.
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
css/frm_admin.css (1)
Line range hint
8228-8248
: Combine duplicate focus state stylesThe focus styles are duplicated between two selectors. Consider combining them for better maintainability:
- .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) textarea:focus, - .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) input:focus, - .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) select:focus, - .frm_wrap input:focus, - .frm_wrap select:focus, - .wp-core-ui .frm_wrap select:focus, - #frm-form-templates-modal select:focus, - .frm-btn-group .multiselect.dropdown-toggle:focus, - .frm_wrap textarea:focus { - border-color: var(--primary-500) !important; - box-shadow: none !important; - } - .wp-admin .frm_fields_container textarea:focus, - .wp-admin .frm_fields_container input:focus, - .wp-admin .frm_fields_container select:focus { - border-color: var(--primary-500); - box-shadow: none; - } + /* Focus styles for form inputs */ + .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) textarea:focus, + .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) input:focus, + .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) select:focus, + .frm_wrap input:focus, + .frm_wrap select:focus, + .wp-core-ui .frm_wrap select:focus, + #frm-form-templates-modal select:focus, + .frm-btn-group .multiselect.dropdown-toggle:focus, + .frm_wrap textarea:focus, + .wp-admin .frm_fields_container textarea:focus, + .wp-admin .frm_fields_container input:focus, + .wp-admin .frm_fields_container select:focus { + border-color: var(--primary-500) !important; + box-shadow: none !important; + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
classes/views/frm-entries/show.php
(2 hunks)css/custom_theme.css.php
(1 hunks)css/frm_admin.css
(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- css/custom_theme.css.php
🔇 Additional comments (2)
classes/views/frm-entries/show.php (1)
93-93
: LGTM! Consistent styling pattern applied.
The addition of the frm_wrap
class to the right panel maintains styling consistency with the header section.
css/frm_admin.css (1)
3857-3868
: 🛠️ Refactor suggestion
Combine fragmented checkbox styling rules
The checkbox styling rules are still fragmented across multiple selectors. This was previously flagged in past reviews. Consider combining them for better maintainability:
- .frm-white-body input[type="checkbox"]:checked,
- .frm_wrap input[type="checkbox"]:checked {
- background-color: var(--primary-500);
- border-color: var(--primary-500) !important;
- }
- .frm-white-body input[type="checkbox"]:checked:focus,
- .frm_wrap input[type="checkbox"]:checked:focus {
- border-color: var(--primary-500);
- }
- .frm-white-body input[type="checkbox"]:checked::before,
- .frm_wrap input[type="checkbox"]:checked::before {
- content: '';
- display: block;
- width: 100% !important;
- height: 100% !important;
- background-image: url("data:image/svg+xml,%3Csvg width='12' height='9' viewBox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6667 1.5L4.25001 7.91667L1.33334 5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A") !important;
- background-size: 9px !important;
- background-repeat: no-repeat !important;
- background-position: center !important;
- margin: 0;
- }
+ /* Checkbox styles */
+ .frm-white-body input[type="checkbox"]:checked,
+ .frm_wrap input[type="checkbox"]:checked {
+ background-color: var(--primary-500);
+ border-color: var(--primary-500) !important;
+
+ &:focus {
+ border-color: var(--primary-500);
+ }
+
+ &::before {
+ content: '';
+ display: block;
+ width: 100%;
+ height: 100%;
+ background-image: url("data:image/svg+xml,%3Csvg width='12' height='9' viewBox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.6667 1.5L4.25001 7.91667L1.33334 5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A");
+ background-size: 9px;
+ background-repeat: no-repeat;
+ background-position: center;
+ margin: 0;
+ }
+ }
Likely invalid or redundant comment.
@Crabcyborg It seems the E2E test error isn’t related to this PR, correct? I’ve reviewed the code and couldn’t find anything related. |
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
css/frm_admin.css (2)
1413-1413
: Consider combining selectors for button stylingThe selector
.frm_single_entry_page #frm-publishing .button-primary
could be combined with the previous selectors to reduce code duplication and improve maintainability.- .post-type-frm_display.wp-core-ui .button-primary, - .frm-button-primary, - .wp-core-ui .button-primary.frm-button-primary, - .frm_single_entry_page #frm-publishing .button-primary { + .post-type-frm_display.wp-core-ui .button-primary, + .frm-button-primary, + .wp-core-ui .button-primary.frm-button-primary, + .frm_single_entry_page #frm-publishing .button-primary { background-color: var(--primary-500) !important; color: #fff !important; }
8208-8210
: Consider consolidating focus state selectorsThe focus state selectors could be combined using
:is()
pseudo-class for better maintainability.- .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) textarea:focus, - .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) input:focus, - .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) select:focus { + .frm-white-body:not(.frm-admin-page-styles):not(.frm-admin-page-entries) :is(textarea, input, select):focus { border-color: var(--primary-500) !important; box-shadow: none !important; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
css/frm_admin.css
(5 hunks)
🔇 Additional comments (2)
css/frm_admin.css (2)
4521-4521
: LGTM! Image option container styling
The selector and styling for image option containers is well-structured and uses CSS variables appropriately.
8221-8230
: LGTM! Well-documented code
The comments clearly explain the purpose of the focus state styling for specific pages. This helps with code maintainability.
@shervElmi Yes, I believe those are unrelated. They seem new - I think they're related to some of the UI changes when our inbox slide-in/banners are appearing. |
This PR resolves styling issues on both the Entry (Edit/New) and Style pages, ensuring a consistent and polished appearance across these sections.
Related Pro PR:
https://github.com/Strategy11/formidable-pro/pull/5501
Related Issue:
https://github.com/Strategy11/formidable-pro/issues/5359
Reproduce Steps:
Fixes:
Before:
After: