[Dojo-interest] keyboard focus issues after 'onkeypress' event

Ken Benjamin kenbenjamin at kenbenjamin.net
Mon Jun 2 15:47:28 EDT 2014


If I understand you right, you are removing the focused item and so leave the
browser to decide what item should be in focus afterwards. My guess is that
this response varies from browser to browser.

Rather than leaving the browser to guess what should be in focus next, why
not simply tell it to focus elsewhere before deleting the button? That way
you can determine which DOM node gets focus.

See: 
http://dojotoolkit.org/reference-guide/1.9/dijit/focus.html#dijit-focus
<http://dojotoolkit.org/reference-guide/1.9/dijit/focus.html#dijit-focus>  

Ken B.


lucky_2302 wrote
> Hi 
> We have a custom widget which creates a tab/pane of dynamic elements.
> 
> It has rows with each row as set of input elements with  buttons 'add' and
> 'remove' which are clickable 
> <divs>
>  encapsulating images.
> 
> 'Add' Button- adds a new row with new buttons and 'remove' button removes
> the row including buttons.
> These buttons appear dynamically if required.
> 
> Initial state: 
> We just have one row: input elements with just 'Add' div (no 'remove' as
> can not remove this only row)
> 
> Clicking -'Add' 
>   -Adds one more row with Input elements and  'add'/'remove' buttons.
>  - since new similar row is added now, Button in first row changes to
> 'remove' instead of 'add'.
> 
> Again Clicking - 'Add' on this new row
> 
>  - New row added with 2 buttons - 'add/remove'
>  - former row button changes to 'remove'
> 
> Clicking  'Remove'  -
>  - removes same row completely.
>  
> So with each button click, that button instance disappears. 
> Issue here is when any of the add/remove button is clicked or keypressed, 
> keyboard focus moves somewhere else like on page top. 
> 
> I was confused if its event bubbling issue but its not.
> Different browsers show different behavior. FF is okay as focus goes to
> next input element with each keypress.
> Is it resize() called on dijit/_WidgetBase when buttons are added/removed? 
> 
> Any suggestions on how it could be fixed?





-----
Kenneth Benjamin 
Web Application Architect for Hire 

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/keyboard-focus-issues-after-onkeypress-event-tp4002477p4002527.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.


More information about the Dojo-interest mailing list