Skip to content
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

Space and enter keys dont work correctly with the selector extension #731

Closed
swapnilghan opened this issue Sep 24, 2013 · 8 comments
Closed

Comments

@swapnilghan
Copy link

I am using dgrid/selector plugin. when I try to select/deselect columns using keyboard keys space or enter the column doesn't change the selection state.

after debugging this problem, it looks like "onSelect" function from selector.js is called twice when space or enter key is used.

following line adds the event listeners

listeners.push(grid.on(".dgrid-selector:click,.dgrid-selector:keydown", onSelect));

but when user hits the space/enter, I guess both click and keydown events are emitted and the onSelect method is called twice and column goes back to the original state.

@kfranqueiro
Copy link
Member

What browser / OS are you seeing this issue in? I have just tried reproducing it in FF, Chrome, IE (9), Safari, and Opera (12) and do not see this issue.

Also, if you're using a store, can you confirm your store items have unique IDs? Failing to do that tends to cause a lot of issues and this could be one of them.

@APGarchev
Copy link

The same issue happens for me working on Chrome 30.0.1599.69 / Windows 7 and Windows XP and IE 8 / Windows XP and IE10 / Windows 7. I tried to embed selector column in a GridFromHtml using the example dgrid\test\GridFromHtml.html. I succeeded, but when focus a checkbox and hit the space bar both keydown and click events fire and that causes the checkbox state to stay same as its old value.

window.selector = selector;
var _store = new Memory({"idPropery": "order", "data": testOrderedData});
window.gridFromHtmlLegacyFormatter = new (declare([GridFromHtml, OnDemandList, Selection]))({"store": _store,
   "selectionMode": "none"}, "gridFromHtmlLegacyFormatter");
gridFromHtmlLegacyFormatter.startup();
<table id="gridFromHtmlLegacyFormatter">
  <thead>
    <tr>
      <th data-dgrid-column="selector({})">Selector</th>
      <th data-dgrid-column="{field:'_item', sortable:false, formatter:testFormatter}">Step</th>
    </tr>
  </thead>
</table>

@kfranqueiro
Copy link
Member

@APGarchev your code has a typo ("idPropery") and thus is not setting idProperty correctly for that data, so that could very well be the problem in your case.

@kfranqueiro
Copy link
Member

Given no further response, I'm closing this issue. If after amending store settings there is still an issue, we can take another look if you can provide an updated reduced test case.

@gerpres
Copy link

gerpres commented Nov 3, 2015

same problem for me (chrome 46, dojo 1.10.4, dgrid 0.3.16) - .dgrid-selector:click and .dgrid-keydown are fired for the selector-checkbox when hitting the [space]-key causing the row to get selected and being immediately deselected.
store is set up correctly

@kfranqueiro
Copy link
Member

Hm. Trying again, I can reproduce this if I click directly on a selector checkbox and then hit space, but not if I focus the cell itself and hit space.

@kfranqueiro kfranqueiro reopened this Nov 3, 2015
@gerpres
Copy link

gerpres commented Nov 3, 2015

the column is configured like

selector({id:'selector',unhidable:true,tabIndex:0})

I'm selecting the checkbox by tabbing into it and then hit [space]

msssk added a commit to msssk/dgrid that referenced this issue Nov 26, 2015
msssk added a commit to msssk/dgrid that referenced this issue Nov 26, 2015
maier49 pushed a commit to maier49/dgrid that referenced this issue Dec 23, 2015
msssk added a commit that referenced this issue Jan 4, 2016
maier49 added a commit that referenced this issue Jan 4, 2016
@maier49 maier49 closed this as completed in 701673f Jan 4, 2016
@rushil-patel
Copy link

I'm seeing a related issue but In this case I'm not using the selector plugin-in. I'm listening for the "dgrid-sort" event which seems to be called twice when "enter" or "space is clicked. It looks like "click" and "keydown" events are fired when "enter" or "space" key is pressed.

This is my listener that appears to be called twice:
grid.on("dgrid-sort", function (evt) {.....}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants