DataTables / TableTools

Please note that TableTools has now been retired and replaced by the Buttons and Select extensions which offers significant improvements and API integration with the rest of DataTables and the other extensions.
http://datatables.net/
Other
237 stars 149 forks source link

Buttons are not responsive when accessed by tab. #91

Open MuellerMatthew opened 9 years ago

MuellerMatthew commented 9 years ago

When a user tabs to the buttons for TableTools, and presses 'enter' the only button which responds is the print preview button. All of the other buttons are non-responsive as the flash plugin is actually activated by a user click on a transparent layer above the button. This means that all of the TableTools are not accessible.

There are two possible ways to fix this, and I am not sure which is the better option. We can either move the tab stops so that the transparent layer is actually receiving the focus when users tab by editing the tab index, or add a default action to the buttons which also trigger the flash plugin.

DataTables commented 9 years ago

This unfortunately is a Flash security restriction which there is no way around that I am aware of :-(. The Flash movie has to have the "focus" in order to be able to call the API events such as copy to clipboard and save to local file. Those actions must also be triggered by a user triggered event - in the case of a click we can do both. For tabbing we first need to give the Flash movie focus, which I'm not aware of a way of doing with a keyboard.

Some details here: http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes.html#head31 .

It is worth noting that TableTools is soon going to be replaced with a new extension called Buttons which is currently in development. It will have Flash options to match TableTools, but I plan also to add options for modern browsers to save files locally. Unfortunately there is no HTML5 API to copy to clipboard so that one is more or less stuck, other than opening a textarea with the table information in it, preselected for the end user to copy manually (which will be an option as well).

So I'm afraid this is unlikely to fixed in TableTools unless someone wants to send a pull request.

MuellerMatthew commented 9 years ago

Ok, I was unaware of the flash limitations. As a temporary bandaid for this issue, we should probably just make the buttons inaccessible by tab by setting their tabindex to -1 so they just get skipped over.

DataTables commented 9 years ago

Sounds like a reasonable thing to do - thanks for the suggestion. I'll add that into the next bug fix release of TableTools.

924060929 commented 9 years ago

Hi MuellerMatthew! I just fixed this issue. When you click the tab, the related div will show.At the time you can re-render the buttons of table tools.Just invoke the function 'fnResizeButtons' of TableTools's instance. First, invoke the static method and get the instance: var tableTools = TableTools.fnGetInstance( 'table_id' ); Seconds, resize the buttons: tableTools.fnResizeButtons(); Then the buttons active!

This is the link to Table Tools API: http://datatables.net/extensions/tabletools/api#Instance-methods