XWIKI-20757: Fix label association for Menu content field in edit mode#5842
Open
Derawaze wants to merge 1 commit into
Open
XWIKI-20757: Fix label association for Menu content field in edit mode#5842Derawaze wants to merge 1 commit into
Derawaze wants to merge 1 commit into
Conversation
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.
Jira URL
https://jira.xwiki.org/browse/XWIKI-20757
Changes
Description
labelrule violation on the Menu entry inline edit page, where the<textarea id="content">had no associated<label>element.<label for="Menu.MenuClass_0_content1">pointed to an ID that does not exist in the DOM — the WYSIWYG service produces a<textarea>whose DOMidis derived from thenameparameter (content) rather than theidparameter (Menu.MenuClass_0_content1).Root Cause
ClassSheetGenerator.xmlgenerates<label for="${doc.fullName}_0_$property.name">for every property, including Content fields. For the Menu app this producesfor="Menu.MenuClass_0_content1".Content.xml(the custom displayer for Content fields) computes$id = "${prefix}${name}"correctly asMenu.MenuClass_0_content1, but the WYSIWYG service ($services.edit.syntaxContent.wysiwyg()) ignores theidparameter and uses thenameparameter value (content) for the actual DOMid.CKEditor then replaces
#contentwith its own UI —#contentbecomes a loading placeholder that disappears after page load, while the real editor (#cke_content) is labeled by CKEditor's own child<label>.Axe finds
<label for="Menu.MenuClass_0_content1">pointing to a non-existent element, and#contenthaving no associated label.Short-Term Fixes
Fix 1:
Menu/MenuSheet.xmlline 44 — Removed theforattribute from the "Menu Structure" label:Rationale: The #content element is a CKEditor loading placeholder, not the real editor. Pointing a to it is semantically incorrect. CKEditor provides its own label for the editor.
Fix 2:
AppWithinMinutes/ClassSheetGenerator.xmlline 52 — Skip generating the for attribute for properties that have a custom displayer:Rationale: Properties with custom displayers (like Content fields using Content.xml) control their own DOM output. ClassSheetGenerator cannot predict the correct for for these properties, so it should not generate one. The$!property.customDisplay check follows the same pattern already used for $ !property.hint on line 55. For standard properties without custom displayers, behavior is unchanged.
Clarifications
WebHome.xmlis intentionally set to<hidden>false</hidden>and is listed invisibleTechnicalPagesin the pom.xml. A local XAR plugin version may incorrectly flag this during-Pqualitybuilds — this is a pre-existing build infrastructure issue, not related to these changes.Long-Term Direction
idparameter for the textarea DOMid, so thatClassSheetGenerator'sforattribute matches correctly.<label>elements'forattributes to point to the CKEditor container when replacing a textarea.fortarget toClassSheetGenerator.Screenshots & Video
N/A (accessibility fix, no visual UI change)
Executed Tests
xwiki/build):mvn clean install -f xwiki-platform-core/xwiki-platform-menu/xwiki-platform-menu-ui -Pquality -DskipTests— passedmvn clean install -f xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui -Pquality -DskipTests— passedMenuIT) could not run locally due to Docker-in-Docker networking limitations on Windows (Testcontainers'testcontainers/sshdcontainer port forwarding fails). This is a local environment issue, not related to the changes. CI will run the integration test.Expected merging strategy