MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit
Refocus after Dialog close triggers Tab change
Personne n'a encore pris cette issue.
- Langage dominant
- C#
- Étoiles
- 16.3k
- Forks
- 3.5k
- Merge moyen
- 1 j 22 h
- PR mergées (30 j)
- 8
Description
The DialogHost tries to "re-focus" the item previously selected. This is the code for it:
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/5533b50a6cff78cb75fbb52e16f7c9e06c62446c/MaterialDesignThemes.Wpf/DialogHost.cs#L268
This is very problematic, when the previous control was a TabItem, because Focus()ing a TabItem actually activates the respective tab.
Here is a very simple reproduction:
- Have a TabControl within a DialogHost
- Focus a given TabItem (i.e. by clicking on an already active Tab)
- In the SelectionChanging Event of the TabControl Show the Dialog (i.e. "Loading data ...")
- Click another Tab
The following happens:
- DialogHost remembers, that the first tab is currently focused
- The click on the second Tab activates this Tab
- Dialog is shown and closed again, after data is loaded
- Dialog calls Focus() on first tab
=> First tab will be selected again
I just created the issue as I'm not sure, what the best solution for this. My current feeling tells me to just check for if(!(dialogHost._restoreFocusDialogClose is TabItem), but there might be other elements, where a re-focus is not desired?
I'd be happy to provide a PR after we agree on a solution.
Also - for now, I'd welcome any idea for a good workaround I could place into the application to make it work for now.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez dans DialogHost.cs autour de la ligne 268 et reproduisez l’interaction avec un TabControl, un TabItem et un gestionnaire SelectionChanging qui ouvre une boîte de dialogue. Vérifiez si la restauration du focus sur l’élément précédemment sélectionné doit être ignorée ou traitée différemment pour les éléments d’onglet, et vérifiez que la fermeture de la boîte de dialogue laisse l’onglet nouvellement sélectionné actif.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- csharp
- Domaine
- desktop
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100