[GMCM & SpaceCore] Stardew Access Integration - #545
Conversation
…ingleTexture` and `ScrollContainer`.
stardew access to speak its contents
Introduced two Event Handlers `MouseEntered` and `MouseHovered` to `Element.cs`. MouseEntered is triggered when the mouse enters an element and MouseHovered is triggered constantly while an element is being hovered. GMCM uses `MouseHovered` to detect currently hovered element and attempts to speak, only if stardew access is installed.
To acheive this, I've added dummy clickable components to all the labels which are used as placeholders for navigation. Added `DummyClickableComponent` property to `Element` for this.
Fixed some bugs from last commit
…ement keys. Pressing Escape key while a textbox is selected will
Added the back button to the nav grid of ModConfigMenu when in TitleMenu.
… mod config menu from closing when openend via options page. And updated sliders to not speak in percentage.
Added docs and comments. Fixed case of IBetterGameMenuApi.cs in SpaceShared.projitems to fix building in linux.
…open. - The cursor now snaps to the Keybind Overlay's instruction label. - Added i18n for GMCM's title menu button
…xtbox's name while selected
Although, this doesn't make CustomBush's config accessible
|
I am very interested in this - the clickablecomponent stuff is something I've meant to do for a while, so that controllers could have snappy movement. The free cursor movement was just a hack until I got that done, so that can be removed entirely (unless vanilla menus have a way to start using it even with snappy menus on?) I somewhat want to work on this as part of GMCM 2.0 that I've been contemplating, since a lot will be changing for both GMCM and the UI library for that. On the other hand. accessibility is important enough that I should go ahead with this anyways, especially for a mod as widely used as GMCM... So yeah, I think I do want to go ahead with merging this. Before I fully review this (since it's a larger PR than most I get), I want to address this:
I think a better approach would be a non- |
Definitely. I'll try to implement it. And just to understand it correctly, how would we subscribe to the non-static events, won't that require subscribing for every object we create? I haven't tested this so I really don't have a clue, and my event implementation was kind of just brute force, I found it easiest to implement although being not ideal. So I'm open to any other way to implement this, if any. One more way that I could think of is having overridable methods for hover and others with default a11y implementation. And I do agree this being in GMCM 2.0, it would be best if we have a11y at the core of the library, makes it easier for devs. |
|
You would only need to subscribe to the RootElement instances, which by nature only have one per screen. This would also be the only class with the event field - any children call their RootElement's version, since they aren't intended for use without one. This would mean that instead of subscribing once in Entry (or where ever you put it), you subscribe each time a RootElement is created (typically once per screen, I think?) The problem with overridable methods is that then you have to subclass those methods to change the implementation, which isn't exactly feasible from an external mod. Are there any other accessibility mods that exist that would find the functionality useful? If so, maybe instead of GMCM integrating with Stardew Access directly, GMCM could provide an API that gives hooks where Stardew Access needs, and then any mod could use that API (and I could add more later if those mods need more). But if there aren't actually any alternate accessibility mods of this type already existing, that might be more work than it's worth on your end. I didn't mean this would wait until 2.0, I actually meant the opposite - I don't want to wait until 2.0, since that likely won't come out until SDV 1.7 - and it will likely be quite a while before it comes out - in case I have to make any compatibility breaking changes for general mod use to make that happen. Also, I'll probably need to design the new API slightly differently to allow custom widgets to interface with Stardew Access properly without needing to do it directly, which would be hard to add with how things work currently (though I could make a small new function or two for that if necessary for a sooner release) |
|
Oh so we would subscribe for every screen like maybe at their constructors. Will this have the possibility to have a default implementation to stardew access, like so, so other mods would only need to add No, there aren't any screen reader mods like stardew access that I can think of, there are tts mods but they only read certain things like dialogs afaik. That's great! Folks have been asking GMCM accessibility for a long time. |
|
Nobody really uses the UI stuff besides me, and most of those mods are either unreleased or not very popular, so I don't think a default implementation is necessary. I do want to eventually rework my UI system entirely, so it'll be something I keep in mind then, but for now, GMCM should be fine. It's a little complicated anyways, becauee GMCM doesn't actually use the copy of the UI that SpaceCore has - it has its own copy that is completely separate. and theoretically any of my other mods could do that, too. (Actually, every mod has a copy right now whether they use it or not, which is something I need to fix.) |
|
Hey, just wanted to check on this since it's been a bit. I know many people are busy during the holiday season, so no rush, but if it's going to be a while longer I want to go ahead and get the release that's currently pending out. |
Oh yeah, go ahead, I'm kind of busy these days with my new job (need to get used to working in corporate and all lol), so I don't know when I'll get back to modding, but I'll try to make time from now on. |
This PR attempts to make GMCM and SpaceCore screen reader and keyboard accessible via Stardew Access.
It does so by adding a dummy
ClickableComponenttoElementwhich is used for gamepad/keyboard navigation only, and implementingIScreenReadabletoElement.Changes
Element.cs:IScreenReadableinterface.DummyClickableComponentandCreateDummyClickableComponentproperties.MouseEnteredandMouseHovered, because the ui components are in SpaceShared, I couldn't figure out how to get StardewAccess' API and directly speak the element here, so instead I added these events with their listener registered while initializing StardewAccess' API.receiveLeftClick()and so on of the active menu, because SpaceCore doesn't handle mouse clicks like that, I hardcoded the keybind for now as I couldn't figure out how to access StardewAccess' API which has the mouse sim keybindings exposed.Table.cs:DummyClickableComponentwhile assigning proper ids for navigation.ModConfigMenu,SpecificModConfigMenuandKeybindsOverlay:allClickableComponents.ModConfigMenu:OpenModMenuaction and addedsnapToparameter to the constructor.NewSkillPageoverrides the vanilla skill page so I modified it similar to how the vanilla page is patched for accessibility, look here.SkillLevelUpMenuand made it accessible. Also modified the bounds of clickable components for better navigation.Issues
These changes include some major changes (like mouse events) so I'm awaiting your input on those and also on how to access StardewAccess' API in
Elementfor mouse click.And I've missed some things which I'm listing below:
This PR should be compatible with v1.7.0-beta.1 of stardew access but I've used the builds from my fork personally.