Page MenuHomePhabricator

Disable auto-capitalization hint on search field of wikis with $wgCapitalLinks = false
Closed, ResolvedPublic

Description

Since Wiktionary is case-sensitive on first character ($wgCapitalLinks is set to false), searching lower-case titles on mobile could be frustrating if auto capitalization is enabled. The fix is just adding autocapitalize="off" to the search <input> element.

Maybe this can be automatically done in any wiki that disabled $wgCapitalLinks?

Developer notes

Using $wgCapitalLinks sounds fine. It may require copying across the autocapitalize property in the client.

TODO

  • Pass autocapitalize to server side rendered field
  • Update Codex to support customization of the autocapitalize field
  • Release Codex 0.2.2 to MediaWiki core
  • Vector should set autocapitalize field based on configuration value
  • MobileFrontend search overlay must be updated to pass the autocapitalize field

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
This comment was removed by Betseg.
Betseg updated the task description. (Show Details)

Maybe this can be automatically done in any wiki that disabled $wgCapitalLinks?

Shouldn't this be done by core then? Or is Minerva overriding something?

Presumably this needs to be done in SkinMustache::buildSearchProps in core, yes as part of the making of html-input

ovasileva lowered the priority of this task from Medium to Low.Sep 23 2020, 8:47 AM

Sounds like a fast-yet-effective fix to this problem. Not sure why the priority got lowered since more and more people are using their smartphone to browse the Wiktionary.

@DSwissK: Other things unfortunately became more important in the meantime. Contributed patches are highly welcome if you'd like to see this fixed. :)

Change 635286 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Respect $wgCapitalLinks in Search input field

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

Ammarpad renamed this task from Disable auto-capitalization on mobile Wiktionary search bar to Disable auto-capitalization hint on search field of wikis with $wgCapitalLinks = false.Oct 21 2020, 12:03 AM

Since Wiktionary is case-sensitive on first character ($wgCapitalLinks is set to false), searching lower-case titles on mobile could be frustrating if > auto capitalization is enabled. The fix is just adding autocapitalize="off" to the search <input> element.

Let me clarify one thing here to avoid misunderstanding after the change, because this task description is assuming something which will not happen.

Note that, there's no any "auto capitalization" on search input text (not the result) of MediaWiki, even on https://en.wiktionary.org/wiki/Special:Search. If you change the case of your (virtual) keyboard, there's nothing that will modify your input to enable the supposed capitalization. (except maybe local userscript)

The attribute is not well-named, because it actually does not enable "auto capitalization". What it does is to effect change to the initial state of virtual keys based on the value. So don't think that your input will automatically be lowercase after this change. It won't. (Only the virtual keys will be). If you toggle the upper case before typing, you'll see upper case in the search field, nothing will change them back to lowercase.

Also, if you're using physical keyboard, you'll not see any change. If you're typing in Wiktionary that uses a unicameral script, you'll not see any change. Nothing at all.

Yes, that's exactly what we need in Wiktionary : virtual keyboard not upercasing the first letter by default.

Change 635286 merged by jenkins-bot:
[mediawiki/core@master] Respect $wgCapitalLinks in Search input field

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

Jdlrobson changed the task status from Open to Stalled.Oct 22 2020, 6:37 PM
Jdlrobson changed the task status from Stalled to Open.Feb 16 2022, 4:41 PM

This is no longer stalled. I belive the existimg search widget on mobile needs to be updated to respect the attribute.

Aklapper added a subscriber: ovasileva.

Removing task assignee due to inactivity as this open task has been assigned for more than two years. See the email sent to the task assignee on August 22nd, 2022.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome!
If this task has been resolved in the meantime, or should not be worked on ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!

Note this won't fix the issue on Minerva until T266072 is further along.

It's marked as "resolved", so will the patch work now?

Change 836268 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[design/codex@main] Allow customization of autocapitalize attribute

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

Change 836268 merged by jenkins-bot:

[design/codex@main] Allow customization of autocapitalize attribute

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

Change 849191 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update Codex from v0.2.1 to v0.2.2

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

Change 849191 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.2.1 to v0.2.2

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

Catrope subscribed.

The Codex release is done. Vector can now set the autocapitalize attribute appropriately.

Change 849652 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Codex search should respect autocapitalize value from $wgCapitalLinks

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

Change 849652 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Codex search should respect autocapitalize value from $wgCapitalLinks

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

Jdlrobson updated the task description. (Show Details)

I don't see any change on mobile browsers (FF & Chrome) and plwiktionary (1.40.0-wmf.8), on-screen keys are automatically upper-cased when I focus the search bar. On a desktop browser using the Minerva skin the search input field has an autocapitalize="none" attribute.

Thanks for checking. It seems there has been no update to the mobile JS. It seems the autocapitalization attribute gets lost when JavaScript enhances the element.

The attribute needs to be added here as well:
https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/src/mobile.startup/search/SearchHeaderView.js#L46

Passed in as a parameter here:
https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/src/mobile.startup/search/SearchOverlay.js#L26

And passed in from Minerva:
https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/master/resources/skins.minerva.scripts/search.js#L40

I'd happily review and merge any attempt to fix this.

Change 857850 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] Add support for autocapitalize in MobileFrontend search overlay

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

Change 857851 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Disable auto-capitalization hint on search field of wikis with $wgCapitalLinks = false

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

Change 857850 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Add support for autocapitalize in MobileFrontend search overlay

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

Change 857851 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Disable auto-capitalization hint on search field of wikis with $wgCapitalLinks = false

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

Jdlrobson claimed this task.
Jdlrobson updated the task description. (Show Details)

This appears to now be working as expected:

Screen Shot 2022-11-21 at 9.02.33 AM.png (405×1 px, 84 KB)

Remember this is a browser /hint/ so only works if the browser uses it.
This will go out with the train beginning the week of Nov 28 (there is no train this week)

The autocomplete attribute is now "sentences", not "off". Any reason why?

@Betseg it depends which wiki you are looking at.
On https://en.wikipedia.org/wiki/Shakerato the value is sentences.
On https://en.wiktionary.org/wiki/shakerato the value is off.
The value depends on how the wiki is configured to use https://www.mediawiki.org/wiki/Manual:$wgCapitalLinks - and this is determined by community consensus.

If it's incorrect on a wiki you frequent, it's best to request a configuration change (https://meta.wikimedia.org/wiki/Requesting_wiki_configuration_changes) by going through your community portal.

Grim-Screenshot-2023-01-28_11:36:43.png (436×949 px, 127 KB)

I'm talking about Minerva Neue on English Wiktionary.

@Jdlrobson I wrote this message on the weekend, pinging in case you miss it.

Weird.. I'm not seeing that myself. I'm wondering if this could perhaps be a caching issue...

You may need to apply ?action=purge to the page if you are seeing the sentences value.

Screen Shot 2023-01-29 at 6.02.43 PM.png (1×1 px, 224 KB)

Can you try that and tell me if this issue still exists?
Thanks in advance!

It works for me on mobile Chrome, it doesn't on mobile Firefox. This should be consistent with both of your screenshots.

@PeterBowman this is a browser hint. It's my understanding Firefox mobile doesn't support it. The attribute appears to be set correctly for me there.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize

@Jdlrobson First changelog on the "Details" section of this task has the autocapitalize: 'sentences' code.

@Jdlrobson First changelog on the "Details" section of this task has the autocapitalize: 'sentences' code.

Hi @Betseg I'm not sure what you are trying to say here. The line you reference to is not the final value. Hopefully this makes sense if you are technical:

  • That code uses util.extend. It's overridden by props which flows from searchHeader:

https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/8f104f2c57104e4eb7c7917c9ade81ec444bfbfd/src/mobile.startup/search/searchHeader.js#L19

https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/e91457643827ecc3d79bd501bf428d5c8c0d75c5/resources/skins.minerva.scripts/search.js#L43

Are you seeing the issue still on that page ? (not sure if you missed by earlier comment T251664#8571060 )

It's also possible a gadget might be interfering some how...

Are you seeing the issue still on that page ? (not sure if you missed by earlier comment T251664#8571060 )

Yes, I am, and yes I purged the page.

It's also possible a gadget might be interfering some how...

In the screenshot I posted I'm in a private tab with no cookies and it still has autocapitalize="sentences"

Okay I can replicate this in Firefox now. I've opened T328390. Glad we got to the bottom of this! Thanks for flagging this issue!