Skip to content

Conversation

@ndarilek
Copy link
Contributor

This continues my work on a Godot accessibility addon for blind users.

Without these signals, the only way to determine if text has been inserted or deleted is to do the following:

  • Cache the current text.
  • Hook the text_changed signal, then do the following:
    • Loop through the new text, comparing it with the old, to determine what text has been added. Correctly manage the index to avoid off-by-one errors in the diff, and also handle the corner case where text is pasted so more than one character was inserted.
    • Essentially do the opposite on deletion.
  • Cache the new text for future iterations.

This is certainly doable, but a huge mess, and realistically I'm probably going to be the only one developing this addon for quite some time. So if it doesn't need complex diffing logic right out of the gate, that's probably a massive plus.

It's probably also better to handle this directly in the engine, because the engine already knows when text is being inserted or deleted. As such, the logic is much simpler.

I'll gladly implement this in TextEdit once we've agreed on the design.

I'm a bit unclear how to handle the undo/redo case. Given that the only use for this is a screen reader, I'm happy just stating that the screen reader won't perfectly handle the undo/redo case for now, then punting implementation down the road for anyone else who may need it.

Thanks.

@groud
Copy link
Member

groud commented Jun 28, 2018

It's a little bit unclear what the usecase is. Why would you need that ?

In any case this feels a little bit too specific. I wonder if it is worth merging.
I think there's probably a better way to handle that, either via input, either via checking what's in the undo-redo queue. If it's not possible, I think it would probably be cleaner if we use one of the text_changed signal parameters, instead of defining new signals.

@ndarilek
Copy link
Contributor Author

ndarilek commented Jun 28, 2018 via email

@ndarilek
Copy link
Contributor Author

Sorry for the noise. To add a bit less frustrated/emotional context to this:

I submitted #19522 about a week ago, and was advised to pursue a solution other than signals. I did that, then when I needed to improve the accessibility of LineEdit even further to account for typing/deleting characters, the caret-tracking code I added to compensate for not having a signal started triggering when it shouldn't. So because I implemented one feature without a signal, which I specifically designed not to trigger in this case, I have to add additional code to distinguish between text moves because the cursor is navigating around, and text moves because characters are inserted and deleted. I recognize that this is only a single issue, but multiply it by 10, 20, etc. and maybe you can see my concern. Eventually my accessibility addon, which I'll probably be the only or significant maintainer of, is going to have so many hacks to perform things everyone else has signals for, that it's going to be a pain or impossible to maintain, and that's already starting. I want to be sensitive to folks' needs and not add a signal for every little thing, but at the end of the day I'm going to need something if folks truly support this project, and typing text/arrowing around isn't exactly a path where every last bit of performance is needed. :)

Thanks.

@groud
Copy link
Member

groud commented Jun 28, 2018

Well, we provide a generic API, not a bloated one with all possible use cases. The text_changed signal is a generic one and works in 99% of use case. So yeah, it might need a little bit of workarounds in your situation, since your use case is really specific.

But to be honest, I dont even find the workaround you presented that dirty.

@groud
Copy link
Member

groud commented Jun 28, 2018

That being said, adding the signals might be worth it, but i think it would be better to have more than one specific use case to be sure if it is worth adding to the core.

@ndarilek
Copy link
Contributor Author

ndarilek commented Jun 28, 2018 via email

@ndarilek
Copy link
Contributor Author

ndarilek commented Jun 28, 2018 via email

@groud
Copy link
Member

groud commented Jun 28, 2018

a loop through the text performing comparisons, then tracking whether text is adjacent or not to know whether to speak it as a single chunk or character, will not be elegant. :)

Yeah, that one. it might not be elegant, but that's not the purpose of code. If it's 10 lines more on your side, but bloat for everyone in the API, it might not be worth adding. Since the workaround is not that complicated and the use case is very specific.

Just follow the chart ^^:
https://twitter.com/reduzio/status/941799197774315525

Anyway, it should probably be discussed with other on the next PR meeting.

@ndarilek
Copy link
Contributor Author

ndarilek commented Jun 28, 2018 via email

@groud
Copy link
Member

groud commented Jun 28, 2018

Oh sorry I did not figured out. Obviously the picture isn't useful... ^^
Well for now the PR meetings are quite happing wherever @reduz is available. There's probably going to be one next week (with 200 pending PRs, it's pretty urgent now...).

Regarding your project, I think this is going to be difficult to build it using gdscript though. Maybe I'm wrong, but I think that might be the the kind of things that could be implemented directly in the engine itself, instead of plugins (screen reader compatibility I mean). Since it would benefit for both the editor and games. But I have no clue how such thing could be implemented.

@ndarilek
Copy link
Contributor Author

ndarilek commented Jun 28, 2018 via email

@groud
Copy link
Member

groud commented Jun 28, 2018

I mean, if bloat is the concern, then implementing all the accessibility functionality from my addon directly into the engine is going to add lots of bloat. :)

Yeah, but that's for a good cause I think. And it's not bloat in the API, but more code in general, which is fine (as it should not really hurt performances). Built-in accessibility features would be a really good thing in my opinion. Gnome has a built-in accessibility layer, we could probably do something like that.

However, I thing we have no clue where to start to do that. I cannot figure out, from what I read on the net, what is needed. I can't find any API that we could intergrate or something like that. It's a bit annoying. Maybe you could open an issue (or comment on #14011) to describe exactly what is needed ? Writting down what you are trying to achieve might be a good start to get people involved.
(thinking about it that would have been a good "google summer of code" project)

@ndarilek
Copy link
Contributor Author

ndarilek commented Jun 28, 2018 via email

@groud
Copy link
Member

groud commented Jun 28, 2018

Honestly I don't think this is that much work to call a function when a Control node enters focus.
Most of those nodes share the same code, so its probably not that much work to call a function when they enter focus.

I hoped a generic API would exist, but if there are none, we can still have a platform dependant code somewhere, it's not a problem. I think the best solution would be to create an "accessibility API" within Godot. Like the visual server but for accessibility functions. Still, what it should be able to do is to be defined.

@ndarilek
Copy link
Contributor Author

ndarilek commented Jun 28, 2018 via email

@akien-mga akien-mga added this to the 3.1 milestone Jul 4, 2018
@mhilbrunner
Copy link
Member

I hoped a generic API would exist, but if there are none, we can still have a platform dependant code somewhere, it's not a problem.

Having worked on accessbility in the past, I think we can reach 90% with a plugin and some generic additions in Godot.

As @ndarilek states, most accessbility APIs are mostly overlapping with things that are useful in general. Like the signals added here: they are actually less cumbersome to use in some cases in general, not only for the accessbility use case.

So I think for the time being, an explicit accessbility server in Godot and related infrastructure would be overkill.

I propose we just try to support @ndarilek with this plugin work and make changes where it makes sense if we can accommodate them, especially in cases like this were they may generally be useful and where they are not breaking compatibility.

@akien-mga
Copy link
Member

Sorry for the late update.

We didn't really reach a consensus on this issue, and after re-discussing it today on IRC, we think that it's not a good idea to add those signals if they won't have an actual use case in production.

I'd really like to have accessibility features in Godot, either as a plugin or built-in, but our development philosophy is to add features only when there are direct use cases for them. In this case it seems the accessibility plugin is still in its early days, so there wouldn't really be any actual user for those features.

I understand that it's a bit a catch 22 situation, as those features are needed to develop an accessibility plugin, but there's little incentive to develop such plugin if those features don't get merged. There are still ways to implement what the plugin needs without changing the engine though, or alternatively the plugin can initially be developed with a custom build of the engine. Once proven working, the features which need to be added to the engine can be reviewed and likely merged more easily -- it's always easier to justify changing the API when the benefit for the end users is immediately clear.

So I'm closing this for now, but if you're still interested in developing an accessibility plugin for Godot, I'd be happy to discuss further what kind of features are needed to do so exactly, and help you find the right API already provided by Godot, or which one should indeed be added to make accessibility a reality.

@ndarilek
Copy link
Contributor Author

ndarilek commented Aug 28, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants