Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Enhancement] Desktop: TabStop/TabIndex support (for multiple Views) #1700

@PureWeen

Description

@PureWeen

Rationale

Currently there is no way to influence the tab stop behaviors on UWP. Seeing as how there are a lot of UWP controls that have this property it's very tedious to implement this across all desired elements

Implementation

Add IsTabStopProperty and TabIndexProperty to all applicable Forms controls. IsTabStop and TabIndex are properties of Windows.UI.Xaml.Controls.Control so all XamarinForms elements that map to a Control in UWP will need these properties added

  • InputView (covers Entry, Editor)
  • DatePicker
  • Button
  • ComboBox / Picker
  • CommandBar? so adding to NavigationPage
  • TabbedPage
  • ProgresBar
  • SearchBar
  • Slider
  • Stepper
  • Switch
  • TextCell
  • TimePicker
  • Anything I forgot?
public static readonly BindableProperty IsTabStopProperty = BindableProperty.Create(nameof(IsTabStop), typeof(bool), typeof(<view adding to>), false);

public static readonly BindableProperty TabIndexProperty = BindableProperty.Create(nameof(TabIndex), typeof(int), typeof(<view adding to>), 0);

Possibly surface the TabFocusNavigation property as well

    public enum KeyboardNavigationMode
    {
        //
        // Summary:
        //     Tab indexes are considered on the local subtree only inside this container.
        Local = 0,
        //
        // Summary:
        //     Focus returns to the first or the last keyboard navigation stop inside of a container
        //     when the first or last keyboard navigation stop is reached.
        Cycle = 1,
        //
        // Summary:
        //     The container and all of its child elements as a whole receive focus only once.
        Once = 2
    }

Control.On<Windows>().SetTabFocusNavigation(KeyboardNavigationMode)

Expected Result

Android

Has

android:nextFocusLeft 
android:nextFocusDown

Correlating this to TabIndex could prove difficult

iOS

Doesn't appear to exist easily. Would need to attach to the tab keyboard command and manually set first responder

UWP

Map the property from the Forms element to the applicable UWP control

Implications for CSS

Backward Compatibility

Third party renderers may need to be updated to ensure that this functionality is supported through the new official mechanism. Further we will need to be careful to code the changes to the renderers in a careful manner to ensure that if someone is already using an effect support this feature that the effect is as best as possible not broken by our changes.

Difficulty : Medium

This task overall shouldn't be very difficult. Just a lot of places to get applied into UWP

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions