Focus doesn't work?

The Help says:

“The Focus-Event is fired when the event gets the focus. Only works for cells with “Editable in prototype”, buggy. (#625)”.

I assume ‘event’ should be ‘cell’?

It still doesn’t work? Not when I tried to use it. Would be a great feature (at least for me).

It currently does not work for text-input. Here an example which uses the Focus-State (here only a background-change), and the Focus-Event:

focus.zip (186.1 KB)

In its current form it does not work for text-input though, for this reason we are unsure what to do with it. We can not leave it in its current form.

What do you want to do with the focus-event?

Hello Felix,

Thanks for the fast feedback.
What I really would like to have is a functional focus-out on text-input: show/hide a cell and that sort of things.
However, it is more a nice to have. We are still talking about a prototype tool, not a working application.
I was just curious because the feature is there.
I’m now trying to figure out how I can use the current implementation to my benefit.

The focus is really useful and I have put it to good use. Just a couple of questions:

  • How can I influence the tab sequence?
  • How can I show the tab sequence in a dynamic text field? I want to overlay everything that has a focus with a badge displaying the tab sequence of the element.
  • How can I select the whole content of a focussed text input field? I am faking this now but I am getting the insertion cursor. The insertion cursor should be hidden and the text be highlighted when tabbed to.
  • On windows, there is no real default button, like on macOS. Instead, the default button receives focus as a dialog is opened. I cannot seem to set focus manually by telling an element to go to focus state on screen load. is there any other way? (I am using targetCells[0].DOMElement.setAttribute("tabindex", 0) for the button to receive focus on tab)

    Focus.atype.zip (2.6 MB)

the order is calculated by the browser, but you can change it with setting the tabindex. Currently you have to use a script-action on the “load screen”-Event:

targetCells[0].DOMElement.tabIndex = 3;

I do not no a way to get the “automatic”-tabindex but if you set it anyway (see above) you can read the tabIndex.

this one is a little bit complicated. Since we value the styling-possibilities more than the interaction we do not use a <input type="text">-element (which does this automatically for you), but set the contenteditable-property on the cell. I see two options: use a <input type="text">-Element instead of using the “Editable in Prototype”-property. Or use script-actions to imitate the desired behaviour.

To set the focus, you have to use the focus()-method. For a load-screen-event add the following Script-Action:

targetCells[0].DOMElement.tabIndex = 0; 	// to get focus
targetCells[0].DOMElement.focus(); 		// default-button: set the focus on load
1 Like

just for the record all this applies to this update: New Icon Set, bug fixes and more … which changed the way focus works.

1 Like

That helps. Thanks so much!