Page MenuHomePhabricator

mobile-html: Exclude elements from theming using a `notheme` class instead of querying every page for specific elements
Closed, ResolvedPublic

Description

Background information

The apps currently have complex checks for very specific parts of templates that need to be excluded from theming. This is not a tenable long term solution. These templates will likely change and new templates with the same problem will be added in the future. The existing check that was upstreamed into mobile-html was the most expensive part of generating the page and would have only gotten more expensive as more exclusions were added. This expensive check was removed as it was one of the main causes of T229286.

What
  • Have a CSS class that can be used by editors to exclude certain items from theming. I’m proposing notheme as it matches the existing nomobile.
  • Provide a way for editors to provide theme-specific CSS to their templates through TemplateStyles
  • Have the mobile-html endpoint add notheme to elements and their children that have an inline backrground style
How
  • [DONE] Update the page library
  • [DONE] Remove the expensive check from the mobileapps service
  • [DONE] Create a working prototype of mobile-html that adds notheme to elements with an inline background style. Site, title, and theme (t=d,t=s,t=d) can be changed to evaluate the results. This leaves more elements unthemed but fixes the examples that were excluded by the expensive check.
  • [DONE] Create a working prototype of how template could provide themed styles for their templates with TemplateStyles
  • [ONGOING] - This should be done as we come across templates that are broken: Comment on the talk page of the templates we were manually excluding encouraging them to adopt template styles or add the notheme class to the appropriate elements. Provide a link to this ticket, a screenshot of the issue, and a link to a copy of the template in userspace with the changes made already.
Open questions

Are there any better alternative solutions? Open to other suggestions

While the prototype does solve the named examples in a performant manner:

Screen Shot 2019-10-24 at 11.59.24 AM.png (984×784 px, 103 KB)

Screen Shot 2019-10-24 at 11.57.26 AM.png (1×1 px, 113 KB)

Screen Shot 2019-10-24 at 11.54.55 AM.png (1×1 px, 278 KB)

It leaves additional items unthemed:

Screen Shot 2019-10-24 at 11.53.53 AM.png (1×796 px, 809 KB)

Screen Shot 2019-10-22 at 9.11.24 AM.png (742×2 px, 452 KB)

Are we OK with this tradeoff while we work with template editors to make the necessary changes to fit in with themeing?

The alternative is to over-theme and break the appearance of templates until they're updated to be excluded from theme-ing. That would look like this until templates are fixed:

Screen Shot 2019-10-24 at 2.24.55 PM.png (840×1 px, 61 KB)

Screen Shot 2019-10-24 at 2.35.42 PM.png (1×1 px, 113 KB)

Screen Shot 2019-10-24 at 2.18.48 PM.png (1×2 px, 286 KB)

Screen Shot 2019-10-24 at 2.24.04 PM.png (1×1 px, 1 MB)

Screen Shot 2019-10-24 at 2.27.57 PM.png (852×1 px, 754 KB)

No matter the tradeoff we pick, some templates will still be broken until they are updated. This is obviously a very limited set of test cases. It might be helpful to generate a list of popular articles or templates across multiple languages and examine the output of different options.

Event Timeline

LGoto triaged this task as High priority.
JoeWalsh renamed this task from mobile-html: Exclude elements from theming using a `notheme` class that editors apply instead of querying every page for specific elements to mobile-html: Exclude elements from theming using a `notheme` class instead of querying every page for specific elements.Oct 24 2019, 2:58 PM
JoeWalsh updated the task description. (Show Details)

Change 597054 had a related patch set uploaded (by Joewalsh; owner: Joewalsh):
[mediawiki/services/mobileapps@master] Hygiene: Add clearer documentation about theme exclusion

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

Change 597054 merged by jenkins-bot:
[mediawiki/services/mobileapps@master] Hygiene: Add clearer documentation about theme exclusion

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