Page MenuHomePhabricator

mobile-html: allow clients to adjust tables
Closed, DeclinedPublic

Description

Context
On iOS, users can define whether they want article tables to be collapsed or expanded by default. This means that we need to be able to communicate that preference to the html.
We also need to be able to pass our localized strings for table titles. (T205550)

Proposed solution
Provide a JS function that allows clients to adjust tables.
For example (once T205550 is completed):

wmf.adjustTables = (collapse, locale) => {
    // adjust tables
    if (callback) {
        callback();
    };
};

Questions
Currently, on iOS, when the user taps on a collapsed table's footer, we scroll them back to the top of that table. Is this behavior going to move up to page library or are we expected to continue handling it ourselves?

Event Timeline

@bearND to move under the appropriate epic and prioritise. This could be blocked on figuring out how the app injects settings to the web view.

@Sharvaniharan @NHarateh_WMF Is this used by the apps by itself (just collapseTables)? If so how or where is it used? This functionality is exposed by the setMulti() function which should be called when a page loads.
Having a separate call for this, when we cannot reasonably assume what the state of the table collapsing is would require some refactoring work. That's why I wanted to check first if this is even needed as a stand-alone function.

Same on android @bearND . We use it while loading the leas section as a meta preference.:
https://github.com/wikimedia/apps-android-wikipedia/blob/master/app/src/main/java/org/wikipedia/page/PageFragmentLoadState.java#L412
Further we have a native transform for it.

Then we can close this. Thanks, @NHarateh_WMF and @Sharvaniharan!