Page MenuHomePhabricator

Investigate feasibility of modifying the display of individual preferences on mobile web [8hr]
Closed, ResolvedPublicSpike

Description

As a mobile editor, I want to change my user preferences with the confidence that I'm not going to configure a setting which doesn't affect my experience, so that I don't get confused.

As part of our work to investigate making Special:Preferences available to mobile editors, we discovered that many settings do not change anything for mobile users.

While some tabs only contain settings which are applicable to users on any device (User Profile and Notifications), others contain a mix of applicable and non-applicable settings. For example, the Search tab contains some settings to configure the default number of search results to display, which works on both mobile and desktop views. However it also contains settings to configure advanced search settings, which is not displayed on mobile.

Ideally, mobile editors would either not see settings which don't affect their experience, or these would be flagged in such a way that this is understood. We want to understand the technical feasibility of flagging or completely hiding certain options on a per-setting basis.

Questions

  • Some settings are only shown on certain projects. How are settings currently configured for display? Are there any existing options for hiding settings based on the user's skin or device?
    • We can hide settings individually with the hide-if parameter and by creating a hidden field that indicates whether a user is using Minerva or not. You can check a small PoC on the Gerrit patch attached to this ticket. We can also add more hidden fields if necessary. For example, if a setting can be shown if AMC is turned on.
  • If not currently feasible, how might we flag or hide specific settings based on the user's skin?
    • We can hide specific settings based on user skin. See above.
  • If this is not currently technically feasible, what would the steps be to implement this functionality? If this is too large a question for a single spike, or would require substantial investment from technology teams, please explain how the problem needs to be broken up.

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptMay 9 2022, 12:34 PM
Samwalton9-WMF renamed this task from Investigate feasibility of hiding individual preferences on mobile web [8hr] to Investigate feasibility of modifying the display of individual preferences on mobile web [8hr].May 9 2022, 12:34 PM
Samwalton9-WMF triaged this task as Medium priority.
Samwalton9-WMF moved this task from Inbox to Preferences on the Moderator-Tools-Team board.

Some notes from our estimation meeting yesterday:

  • Is there a flag for a user being on mobile? i.e. how do we even detect if the user is on mobile?
  • Where would we store the list of preferences which are or aren't applicable?
  • We could be using the special CSS for this skin to hide specific elements.

Some notes from our estimation meeting yesterday:

  • Is there a flag for a user being on mobile? i.e. how do we even detect if the user is on mobile?

The following code can be used:

if ( ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) ) {
23			$mobileContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
24			$isMobileView = $mobileContext->shouldDisplayMobileView();
25		}

However... that should be used only in exceptional cases as a last resort as we advise avoiding mobile-only workflows in new code. Most of the time, you don't want to target the mobile domain, and instead target screen resolution or skin. What prompted the question?
Preferences support a hide-if parameter so presumably this could be extended to filter out skins which don't support.

Where would we store the list of preferences which are or aren't applicable?

It would be interesting to analyse the preferences and why they are not supported. In most cases, I imagine the issue is the code doesn't load (an easy thing to fix), they haven't been standardized (let's standardize them!) or they are skin specific (in which case they should be using hide-if).

Here's an example of a preference that is limited to a skin: https://github.com/femiwiki/FemiwikiSkin/blob/9f850941dd04fbd24ba569c8e76fe0686a6a109f/includes/HookHandler/SmallElements.php#L22

We could be using the special CSS for this skin to hide specific elements.

I would suggest avoiding this if possible.

If it doesn't introduce any regression, I would suggest to not overload the experience [1], and initially hide the settings that do not affect the mobile web experience: Appearance > Skin, Editing > Editing toolbar, Watchlist > Prediction threshold, and Beta features to name a few. @Samwalton9
compiled an extensive list of what works and where.

We have to consider that for the time being none of the user preferences are easily accessible on mobile web, and we could turn this into an opportunity to progressively roll-out mobile-friendly settings as needed.

We could open a channel with the wider community to understand which of these hidden settings are needed first to mobile web editors, and use their insights to prioritize the needed standardization work.

What do you all think? Is this something that we could consider moving forward?

[1] If we would roll-out all the settings to mobile web, including desktop-only settings, we would have to potentially:

  • mark those settings in some way, for example with a message bar that states that "These settings don’t change your mobile experience.",
  • de-prioritize those settings in the overall information architecture, for example we could move those settings to the bottom of the page so that mobile web editors are not presented with options upfront that do not affect their mobile experience when they open a settings page,
  • collapse those settings to reduce the page scroll needed to scan the content of a settings page on mobile web.

The design and development work needed to not disrupt the mobile web experience might be better invested into the standardization of the above-mentioned settings.

Jon's point about these either being broken or skin-specific makes sense and is probably a good model for addressing this in the long run. There are certainly settings I found which seemed like they could work on mobile but don't, and others which just don't make sense for Minerva at all.

I like the approach that we'd start with an MVP which hides these settings and then we explore options for how to proceed with potentially showing them with disclaimers if necessary, and Phabbing tickets for the items which could be 'fixed'.

Change 811352 had a related patch set uploaded (by Scardenasmolinar; author: Scardenasmolinar):

[mediawiki/core@master] PoC: Hide certain preferences on mobile

https://gerrit.wikimedia.org/r/811352

Test wiki created on Patch demo by SCardenas (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/40851ebb92/w/

@Jdlrobson I created a patch demo to test the hide-if parameter with some preferences. I want to hide the preference if the skin is Minerva. I am using

'hide-if' => [ '===', 'skin', 'minerva' ],

The thing is, it works when I change the Appearance setting to Minerva, but it doesn't work when I toggle to mobile, even if mw.config.get('skin') returns minerva in the console. Do you know why this is happening?

I have a guess... it's likely here that "skin" refers to the preference name not the skin key name.

Confusingly the "skin" key means "Desktop skin" so it's always going to reflect your desktop skin.
There is no preference for mobile skin currently (T173527)
you can verify this by appending ?useskin=minerva to the end of your URL without changing the preference

Perhaps try something like the following (untested) instead:

$currentSkin = $context->getSkin()->getSkinName();// this should be the skin you are currently viewing in rather than the currently saved preference
$hidePreferenceOnMinerva = $currentSkin === 'minerva'; 

$defaultPreferences['watchlisthidebots'] = [
			'type' => 'toggle',
			'section' => 'watchlist/changeswatchlist',
			'label-message' => 'tog-watchlisthidebots',
			'hide' => $hidePreferenceOnMinerva,
		];

One thing to also bear in mind is certain preferences do work in the Advanced mobile mode. For example the watchlist works on advanced mobile just like desktop.

Hope this is helpful.

Test wiki on Patch demo by SCardenas (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/40851ebb92/w/

I have one additional question about this as I was writing T311719:

As I understand it there are some beta features which are ones mobile users might want to turn on. Would it make sense for us to have a separate task to modify Extension:BetaFeatures such that beta feature maintainers register whether a beta feature should be listed for mobile users, rather than handling this at the preferences level in the way we're tackling the 'standard' preferences?

I have one additional question about this as I was writing T311719:

As I understand it there are some beta features which are ones mobile users might want to turn on. Would it make sense for us to have a separate task to modify Extension:BetaFeatures such that beta feature maintainers register whether a beta feature should be listed for mobile users, rather than handling this at the preferences level in the way we're tackling the 'standard' preferences?

I would assume so. Extension:Gadgets allows gadgets on mobile so presumably this would be helpful for beta features too. The mobile web used to have a beta mode, so perhaps on the long term having such a capability would replace it.

I have one additional question about this as I was writing T311719:

As I understand it there are some beta features which are ones mobile users might want to turn on. Would it make sense for us to have a separate task to modify Extension:BetaFeatures such that beta feature maintainers register whether a beta feature should be listed for mobile users, rather than handling this at the preferences level in the way we're tackling the 'standard' preferences?

I would assume so. Extension:Gadgets allows gadgets on mobile so presumably this would be helpful for beta features too. The mobile web used to have a beta mode, so perhaps on the long term having such a capability would replace it.

Thanks. I found T78096 - do you think it would make more sense to have a mobile/desktop distinction, or rather a skin compatibility distinction?

Both. On the long term, the mobile/desktop distinction will be removed though. See T127268.

Change 811352 abandoned by Scardenasmolinar:

[mediawiki/core@master] PoC: Hide certain preferences on mobile

Reason:

We are not planning on hiding preferences at the moment

https://gerrit.wikimedia.org/r/811352