On Tue, Apr 12, 2011 at 4:09 PM, Sergiu Dumitriu <[email protected]> wrote:
> On 04/12/2011 12:57 PM, Stefan Mirea wrote:
>> Hello all,
>>
>> I've been working (and almost finished) a patch to fix the issue:Missing
>> default input focus and Enter key handling
>> <http://jira.xwiki.org/jira/browse/XWIKI-4383>
>
> Hi Stefan,
>
> I envisioned this as a behavioral classname [1] similar to withTip or
> maximizable, which indicates which field should be focused.
>
> Even better, it would be nice to use the HTML5 "autofocus" attribute [2]
> with a JS snippet to make it work in the browsers that don't support
> autofocus.
>
> The problem is that most fields are generated automatically using
> $doc.display or $obj.get, which makes it hard to add classnames or
> custom attributes. One workaround is to do a string replace after that,
> for example:
>
> $doc.display('name', $obj).replace(' size=', 'autofocus="autofocus" size=')

We should not have to use such a workaround IMHO. I would favor a lot
adding new display APIs that accept a map of attribute key/value
pairs.

$doc.display('name', $obj, {
  'class' : 'autofocus maximizable',
  'rel' : 'somerel'
})

This use case is so common.

Jerome

>
>> I have a question regarding point 1) Popups.
>> As far as I've seen in the custom lightbox that xwiki has, no global
>> event is fired when a lightbox "window" has finished loading, other than
>> only a onComplete function parameter which, is useful, but for this
>> specific issue, when talking about opening a popup, I see no reason why
>> to not have the first input element in that box selected by default. The
>> way I tackled the whole point 2) is by automatically selecting the first
>> input for the #admin-page-content object, solving all panels focus at
>> once. I wanted to implement the same functions for the popups, but can't
>> do that without a global event. Therefore I wanted to ask your
>> input/suggestions for this approach
>
> The old lightbox is deprecated and should be replaced as soon as
> possible (developer time is blocking this). I'd rather not spend time
> into it.
>
> If, however, you want to fix this as well, feel free to change the
> lightbox code to fire an event after the content is loaded. While you're
> at it, you could also add events for open and close.
>
>
> One tip: it's better to do small commits than big changes solving lots
> of problems. So, try to make smaller patches for specific issues.
>
>
>
> [1] http://platform.xwiki.org/xwiki/bin/DevGuide/SpecialCSSClasses
> [2]
> http://www.w3.org/TR/html5/association-of-controls-and-forms.html#attr-fe-autofocus
> --
> Sergiu Dumitriu
> http://purl.org/net/sergiu/
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to