-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
XWIKI-20996: AWM entry edit forms don't have labels. #3584
base: master
Are you sure you want to change the base?
Changes from 7 commits
6eff29e
14d4148
4b7fe5c
b06e52a
85773a0
6477c85
00583b6
e565116
71292c4
9e02c72
5c7cd93
b6a9fb9
2e76e37
e805384
7cb96fc
c9a33a3
6a45848
f0a99b8
23d77a5
2ee99f1
c030a53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ | |
#end | ||
{{html clean="false"}} | ||
<input type="text" name="$name" value="$!escapetool.xml($value)" | ||
aria-label="$escapetool.xml($services.localization.render('platform.appwithinminutes.title.edit.label'))" | ||
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. Same here, I wonder if this is really needed. I've just checked and indeed the title label has a 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. When on the ClassEditSheet, the label of the field becomes itself editable. This means that what's usually a label now contains an input. This is implicit input labelling. I'm not sure HTML contains a definite way to handle such a case (label with both implicit and explicit input labelling) and I'd rather avoid meeting it. We could "duplicate" the label but I'd rather keep things as simple as possible and just have an 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. So there are two cases:
I was primarily talking about the second case and didn't notice the first one. For the second case, I kind of agree, but to me this doesn't mean that we shouldn't consider the second case which should be the much more frequent case in which we have a visible label that doesn't contain another input that is not correctly connected with the input. For the first case, I'm wondering if we couldn't remove the 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. Sorry, I just saw your last answer. I found a compromise: This is what is implemented at #3584 (comment) |
||
## The default value for an AppWithinMinutes field should be optional so we make only the actual page title | ||
## mandatory and not the template title, which holds the default title value. | ||
#if ($name == 'title' && $xwiki.getSpacePreference('xwiki.title.mandatory') == 1)required #end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,7 +130,14 @@ define('editableProperty', ['jquery', 'xwiki-meta'], function($, xcontext) { | |
// Allow others to enhance the editor. | ||
$(document).trigger('xwiki:dom:updated', {'elements': editor.toArray()}); | ||
// Focus the first visible input. | ||
editor.find(':input').filter(':visible').focus(); | ||
var editInput = editor.find(':input').filter(':visible'); | ||
editInput.focus(); | ||
// Make sure the edit input has an ID, and use the name of the input as a fallback | ||
if (!editInput.attr('id')) { | ||
editInput.attr('id', editInput.attr('name')); | ||
} | ||
Comment on lines
+140
to
+143
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. I'm not convinced by this. The value of the name attribute can be (and often is) very generic which means it's not a good id because it can conflict with other ids on the page. I'd rather default to a random id, that can have the name as prefix. |
||
// Bind the label to the newly generated edit input | ||
Sereza7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
editableProperty.find('label').attr('for',editInput.attr('id')); | ||
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. Shouldn't this whole code be wrapped in an if-statement if there is an Also, this change seems to be much more general than AWM. I'm not saying it's bad, I'm just saying that it is more general. Shouldn't there be code to remove the 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.
Since this only happens when the promise to retrieve the edit display of a field is achieved, I didn't expect this to happen. I added a condition to finish the function early and skip those changes though, better safe than sorry 👍
Yup, I was navigating through multiple kinds of UI for objects and there was an issue with AWM inline edition. I tracked the cause and ended up changing things here.
Technically it doesn't hurt to leave it. However it's better for HTML clarity to clean up the attribute when it's not useful anymore. Added a couple lines to clean this up on saving or canceling the edition
Sereza7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}).catch(() => { | ||
new XWiki.widgets.Notification(l10n['web.editableProperty.editFailed'], 'error'); | ||
return Promise.reject(); | ||
|
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.
Is this really necessary? Shouldn't this always be used in a form that displays a label? What seems to be rather happening I think is that this textarea has the wrong id/the code for generating the label assumes the wrong id.
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.
Addressed in the latest changes by #3584 (comment) 👍
Note that the there was a comment to make sure the ID wouldn't be changed because it broke style/functionalities. I tried it out and everything seemed fine. With a quick search I could find that there's no specific style anymore.