Skip to content

Open-source Xbox-inspired desktop launcher for Xodus on Linux

TypeScript

Use shared accessible checkbox for runtime prefix consent

Dom Svoboda6e8049c5e564
diff --git a/src/renderer/GameRuntimeFields.tsx b/src/renderer/GameRuntimeFields.tsx
index e9d35bb..0fe4116 100644
--- a/src/renderer/GameRuntimeFields.tsx
+++ b/src/renderer/GameRuntimeFields.tsx
@@ -1,3 +1,4 @@
+import {CheckField} from './CheckField';
import {ui} from './i18n';
import {runtimeFamilyLabels,type GameRuntimeSelection,type InstalledRuntimeFamily} from '../shared/runtime-selection';
export function GameRuntimeFields({value,separate,installed,change,changeSeparate}:{value:GameRuntimeSelection;separate:boolean;installed:InstalledRuntimeFamily[];change:(value:GameRuntimeSelection)=>void;changeSeparate:(value:boolean)=>void}) {
@@ -9,8 +10,7 @@ export function GameRuntimeFields({value,separate,installed,change,changeSeparat
{missing?<option value={value} disabled>{ui('runtime.unavailable',{name:runtimeFamilyLabels[value as keyof typeof runtimeFamilyLabels]??String(value)})}</option>:null}
</select></label>
{value!=='default'?<>
- <label className="check-field"><input type="checkbox" required checked={separate} onChange={event=>changeSeparate(event.target.checked)}/><span>{ui('runtime.separate_prefix')}</span></label>
- <small>{ui('runtime.prefix_warning')}</small>
+ <CheckField required checked={separate} onChange={event=>changeSeparate(event.target.checked)} label={ui('runtime.separate_prefix')} description={ui('runtime.prefix_warning')}/>
</>:null}
</>;
}
diff --git a/src/renderer/game-runtime-fields.test.tsx b/src/renderer/game-runtime-fields.test.tsx
index 9c15a07..c309942 100644
--- a/src/renderer/game-runtime-fields.test.tsx
+++ b/src/renderer/game-runtime-fields.test.tsx
@@ -9,7 +9,7 @@ it('offers only default when no verified variants are installed, never an unbuil
});
it('lists verified families with explicit separate-prefix acknowledgment and save warning',()=>{
const html=renderToStaticMarkup(<GameRuntimeFields value="nexus-cachyos" separate={false} installed={[{id:'nexus-cachyos',label:'Nexus Runtime (CachyOS, experimental)',buildId:'a'.repeat(64),sourceCommit:'b'.repeat(40)}]} change={change} changeSeparate={change}/>);
- expect(html).toContain('experimental');expect(html).toMatch(/type="checkbox" required/);expect(html).toContain('Existing local saves stay in the old prefix');expect(html).not.toContain('checked=""');
+ expect(html).toContain('experimental');expect(html).toMatch(/type="checkbox" required/);expect(html).toContain('class="check-input"');const help=html.match(/aria-describedby="([^"]+)"/)?.[1];expect(help).toBeTruthy();expect(html).toContain('<small id="'+help+'">');expect(html).toContain('Existing local saves stay in the old prefix');expect(html).not.toContain('checked=""');
});
it('shows a missing persisted selection as disabled rather than falling back',()=>{
const html=renderToStaticMarkup(<GameRuntimeFields value="nexus-cachyos" separate installed={[]} change={change} changeSeparate={change}/>);