#2878 - Group Genmapper#2890
Conversation
kodinkat
commented
Feb 16, 2026
- fixes: Group Genmapper #2878
- Added logic to filter fields for the create form, excluding the title field and hidden fields without custom display.
- Integrated mapbox token retrieval for location fields.
- Updated JavaScript to render fields dynamically based on the new field settings, ensuring proper handling of title and other fields.
- Improved modal handling for adding child groups, including validation for the title field and focus management upon opening the modal.
- Removed unnecessary whitespace around conditional checks and comments in the DT_Groups_Base class.
- Enhanced code clarity without altering functionality.
|
@corsacca review ready... |
|
thanks @kodinkat! Would you be able to check why the location dropdown get hidden? Also please evaluate the following: 1. XSS risk in mapbox token injection 2. alert() for validation — genmap-tile.js 3. No loading/disabled state on submit |
…ools-theme into 2878-group-genmapper
- Added new labels for modal and details sections to improve accessibility and user experience.
- Updated JavaScript to utilize dynamic strings for various UI elements, ensuring consistency across the application.
- Adjusted CSS to allow dropdowns in modals to extend outside, preventing overflow clipping.
- Improved error handling messages for better clarity when creating child groups.
Code ReviewGood work addressing the previous reviewer's feedback — the mapbox token injection via A few things worth looking at before merge: Moderate Issues1. Redundant (and overwritten) parent connection In fields.parent_groups = { values: [{ value: parentId }] };But 2.
modalContent.find('dt-text, dt-textarea, dt-number, ..., dt-location-map, dt-multi-text')However, Minor Issues3.
{ values: [{ value: parentId }] }This only affects the (currently dead) code path mentioned in issue #1, but if the logic ever changes to use this explicit field value, a type mismatch could cause an API error. Use 4. Overly complex error message construction const msg = (template && template.replace('%s', error.message || unknownErr)) || ('Error creating child group: ' + (error.message || unknownErr));
const msg = template.replace('%s', error.message || unknownErr);5. Double focus on modal open There's a Positive Notes
|
- Added logic to skip 'user_select' fields in the Add Child flow to streamline the process.
- Cleaned up JavaScript code for better readability and consistency, including dynamic string handling.
- Enhanced error handling for parent ID validation to ensure proper data types and prevent NaN issues.
- Updated focus handling for modal fields to improve accessibility and user interaction.
Code ReviewThe previous reviewer feedback has been well-addressed: mapbox token injection now uses A few remaining items: Issues1. Conflicting overflow values on modal content In content.css('overflow-x', 'visible').css('overflow-y', 'auto');Per the CSS2.1 spec, when one overflow axis is non- The actual fix for the location dropdown clipping is the CSS rule in #template_metrics_modal_content .form-field-location {
overflow: visible;
}That targets the field wrapper div directly, which is correct. The jQuery line can be removed to avoid confusion. 2. Silent field omission when Non-title fields are only rendered inside 3. Removed "Generation" section from group popover (undocumented) The diff removes this block from // Generation
if (data.content) {
html += '<div class="popover-field">';
html += '<strong>Generation:</strong>';
...
}This change is not mentioned in the PR description or the referenced issue. Was this intentional? If Minor4. Using 5. Redundant const parentId = parseInt(jQuery('...').val(), 10);
if (\!postType || \!parentId || Number.isNaN(parentId)) { return; }
Positive Notes
|
- Updated PHP to pass title field settings as a dedicated key instead of including it in the main fieldsToRender loop.
- Adjusted JavaScript to utilize the new titleFieldSetting key for rendering, improving clarity and reducing redundancy.
- Enhanced comments for better understanding of the title field rendering process.
Code ReviewThis PR addresses issue #2878 by enriching the "Add Child" modal in the generational map to support configurable Previous Review Items Resolved
Issues to Address1. PHP: The early 2. PHP: Array form of if ( $field_setting['in_create_form'] === true || is_array( $field_setting['in_create_form'] ) ) {
$create_form_fields[ $field_key ] = $field_setting;
}When 3. JS: Redundant
4. Pre-existing:
5. JS: Hard-coded web component tag-name list for field collection The Minor Nit
Overall the implementation is well-structured, fallback handling is thorough, and |
- Refactored the condition for including fields in the create form to clarify the handling of the in_create_form setting.
- Improved comments to enhance understanding of the logic related to post type inclusion in the create form array.
Code ReviewThis PR does a solid job of addressing the feedback from the previous review. The three main issues raised (XSS risk, untranslatable strings, missing loading state) are all properly resolved. Here's a breakdown: What's done well
Issues to address1. Using modalContent.prepend('<div class="alert callout">' + window.lodash.escape(msg) + '</div>');The translatable strings ( 2. Redundant title/name filtering in JS
3. PHP field filter: if ( isset( $field_setting['type'] ) && $field_setting['type'] === 'user_select' ) {
continue;
}The comment says this targets if (
isset( $field_setting['type'] ) && $field_setting['type'] === 'user_select'
&& empty( $field_setting['in_create_form'] )
) {
continue;
}4. CSS rule targets a shared modal selector #template_metrics_modal_content .form-field-location {
overflow: visible;
}
Minor / Nits
SummaryThe core fixes (XSS, i18n, loading state) are solid. The main remaining items:
|
|
@corsacca review ready.... |
|
@kodinkat the location options list still is cut off. Do you get the same behavior?
|
…ools-theme into 2878-group-genmapper
…end outside modal boundaries and adjust overflow settings for improved usability. Implemented class management for modal closure to maintain styling integrity.
Code ReviewGood work on this PR! The feature addresses the issue well — the generational map's "Add Child" modal now respects the site's configured Issues1. In A more robust approach would be to keep 2. Field key detection can silently fail in const fieldKey = component.name || component.id?.replace(fieldPrefix, '');If a component's 3.
This affects all three re-enable calls in 4.
Minor Notes
What's good
|
…e child field prefix to improve code maintainability. Updated field prefix usage in multiple locations for consistency. Enhanced button state management by switching from to for disabling buttons, ensuring better compatibility across browsers.
|
PR Review: Group Genmapper (fixes issue 2878). Good overall work - the changes add dynamic field rendering to the Add Child modal, improve i18n coverage, and introduce better UX patterns. Positive: all hardcoded strings now go through wp_localize_script, submit button is properly disabled during async calls, modal class is cleaned up on close, and there are good fallbacks throughout. Issues found: (1) parseInt result guard works but isNaN check would be clearer intent; (2) alert() calls are blocking and jarring - the existing .group-genmap-message element with aria-live could be reused for inline errors; (3) hardcoded component tag name selector will silently skip new web component types added in future - a data-attribute approach would be more maintainable; (4) template.replace('%s', error.message) can corrupt output if error message contains dollar-digit sequences - use template.split('%s').join(...) instead; (5) overflow-y:visible inline style may be silently ignored if overflow-x is already set - the genmap-d3.css rule is the correct fix; (6) component.name fallback in field key resolution could mismatch if name differs from id-without-prefix. Test suggestions: test with multiple in_create_form field types, test modal re-open after failed submission, test with no Mapbox key, test RTL. Overall solid work - items 3 and 4 are most likely to cause silent bugs. |
|
@corsacca location options no longer cut off....
|
|
Thanks @kodinkat! |



