Problem/Motivation
When selecting a timezone you have to choose from a list of 422 items. Quickly finding an entry in this list can be difficult as you have to look through options with the same region and typing city names does not work.
Proposed resolution
Group the options by region, listing the city so that typing will select the appropriate entry.
User interface changes
The list of timezones in the widget will change to be a list of cities, and not timezone names.
Before:
After:
Remaining tasks
Needs Before and after Screenshots. DONE, comments #2 and #18.Needs Accessibility Review.DONE, comment #19Needs Usability ReviewDONE, comment #34Needs patch updated to address comment #65- DONE, patch #72 fixed those.Needs automated tests - See comments #63 to #66.- DONE, patch #77- Approve API addition. Needs confirmation that it is backwards-compatible.
Needs change record for the API addition.
API changes
Adds an optional new $grouped = FALSE
parameter to system_time_zones()
. If true, the timezones are returned with an additional level of nesting, grouped by continent. See Change Record https://www.drupal.org/node/2873857
Data model changes
None.
Scope
It is IN scope to reformat the options of the select list to make the current list easier to select from, especially via keyboard type-ahead.
It is OUT of scope to alter the list options, either by number or value, such that an option can be picked that was not pickle before the change.
It is OUT of scope to completely alter the method of inputting the timezone information, via something other than a select list.
Comment | File | Size | Author |
---|---|---|---|
#135 | 2847651-test-only.patch | 689 bytes | mpdonadio |
#120 | test.gif | 428.73 KB | droplet |
#113 | c20170711_123652.png | 24.26 KB | droplet |
#104 | interdiff-102-104.txt | 4.19 KB | mpdonadio |
#104 | 2847651-104.patch | 8.56 KB | mpdonadio |
Comments
Comment #2
rachel_norfolkAs discussed (and worked on together with John Cook) here is a patch that will render the zimezones grouped in OPTGROUPs. This makes it much easier to work with a screenreader and has the beneficial side-effect of meaning we can finally just type the city name of the zimezone and have it automatically selected.
The screenshot shows how the zimezone regions are made into OPTGROUPs.
Comment #3
BarisW CreditAttribution: BarisW as a volunteer and at LimoenGroen commentedThis is an amazing improvement. Would love to see this in core!
I found one bug, see screenshot (UTC).
Comment #4
BarisW CreditAttribution: BarisW as a volunteer and at LimoenGroen commentedScreenshot, not patch.
Comment #5
rachel_norfolkYeah - I was waiting for someone spotting that ;-)
This should be a little better.
Comment #6
rachel_norfolkForgot to set as Needs Review - again!
Comment #7
rivimeyGiven the patch a once-over and the code looks good, just two other issues.
According to api.drupal.org there are 8 call sites, of which 2 are changed in this patch. I think it would be good to comment the other sites that this new interface is available, so it is clearer in the patch and/or comment in the issue why the other call sites do not need change.
See: https://api.drupal.org/api/drupal/core%21modules%21system%21system.modul...
Is system_time_zones included in a unit test suite? It would be good to extend test coverage for the new functionality.
Comment #8
rachel_norfolkThanks for the review.
Comment #9
ifrikThanks this is a great improvement, because now typing the name works, and the list is much easier to scan.
It's also a nice example on how an accessibility issue improves usability in general.
Comment #10
csg CreditAttribution: csg at Cheppers commentedIt works perfectly on the Regional settings page, however, the timezone is initially set during installation and that form throws a warning when this patch is applied:
Comment #11
rachel_norfolkhmm - that's interesting - I didn't see that.
Comment #12
rachel_norfolkAh! The UTF8 is a single text entry, not an array, so we probably shouldn't sort it! Oops.
Comment #14
csg CreditAttribution: csg at Cheppers commentedAwesome, that fixed it. RTBC.
Comment #15
rachel_norfolkI think it is time we had some Accessibility and Usability maintainers take a look at this. It seems, as far as actually doing what was requested, we are there.
Adding tags & additional tasks...
Comment #16
rachel_norfolkComment #17
martin107 CreditAttribution: martin107 as a volunteer commentedWhile following along, I noticed two small coding standard errors
1) missing param type
2) space between function call and brackets
otherwise looks good to me.
Comment #18
ok_lyndsey CreditAttribution: ok_lyndsey as a volunteer commentedTested patch with NVDA screen reader on windows; tab through to Default time zones - screen reader reads: "Default time zone box list collapsed Berlin"
Can either type name in directly; or hit enter and list expands. Time zone regions display grouped. Can type and name is selected. Letters typed are read out by screen reader and in most cases the city/region name is read out; not always though which is odd for example "Darwin" but assume this is screen reader as many others tested work fine and entire name of city/region was read out. Can then tab out of field as expected.
Below before patch:
Compare to before patch; No screenreader information read out when navigating options, no region grouping. Function not able to be completed with screenreader.
A seemingly small change that solves a usability and accessibility issue - great work.
Comment #19
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedtl;dr - I'm happy to sign this off for the accessibility gate :)
@JohnCook, @rachel_norfolk and myself spent quite a lot of time playing with this at the Sheffield (UK) meeting during Global Sprint Weekend.
I tested this with:
Plus @ok_lyndsey tested with Windows + NVDA + Chrome in comment #18.
Keyboard users benefit from the general usability win of being able to type the first 2-3 letters of a city name, without first having to quickly type the entire name of a continent (and a slash).
The most obvious change to the screen reader experience is that the continent names are not read out before every city. On the whole this feels like an improvement; you no longer have to listen to the entire phrase "America" before confirming that you have scrolled to "America/Los Angeles". This could make it drastically quicker for screen reader users who are going through all the options instead of typing the name.
Note that screen readers do not yet give any special treatment to HTML
<optgroup>
elements. If you scroll so that an optgroup is in focus, it will be announced, but AFAIK no current screen-reader lets you drill down by selecting an HTML optgroup first.I can think of one potentially confusing scenario. Say a user has found Macau, but was looking for Madrid. These ought to be near each other alphabetically, but they are in separate optgroups. Europe and Asia are such large groups that it's possible to open the select widget and not see any optgroup names in the viewport. On the whole, I feel the benefits of typing ahead probably outweigh this scenario. It is mitigated in a few ways however:
The original list of timezones includes some three-level strings, such as "America/Argentina/Cordoba". This patch removes the middle level, and HTML optgroups only support 2-levels. So a user will not find the Argentinian cities grouped together. Since users will very likely to know the major city names in their own country, type ahead and alphabetical order will mitigate this for many users.
From an accessibility point of view, we need to ask:
Removing the "needs accessibility review" tag. Please add it back if the approach changes, or we discover something new relating to accessibility.
Comment #20
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedminor issue summary updates, tick off some tasks.
Comment #21
rachel_norfolkAdding final screenshots to Issue Summary
Comment #22
rachel_norfolkComment #23
rachel_norfolkbizarre that the screenshot was not appearing...
Comment #24
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedUpdating issue title....
"Group timezones by region" - well, they already are. The "Europe/London" style does that. So how about "Improve timezones selector with optgroups."
Comment #25
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedPatch from comment #12. This is an API addition, hopefully non-breaking and backwards compatible. Adding it to the issue summary, tagging for approval.
Comment #26
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedNo data model changes, updating summary.
Comment #27
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedImproving alt text for screenshots in issue summary
Comment #28
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedComment #29
bojanz CreditAttribution: bojanz at Centarro commentedThis looks like a great UX improvement. Good job, everyone.
Small nitpick:
We never say "If evaluates true", we say "If TRUE". I suggest the following wording "(optional) Whether the timezones should be grouped by region."
Comment #30
rachel_norfolkI'm never afraid of some nitpicking - it's how I learn!!
Comment #31
xjmImprovements like this should now be targeted against 8.4.x. Thanks!
Comment #32
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedEasy Timezone Select is a related D7 contrib moudle which does something similar.
Comment #33
wturrell CreditAttribution: wturrell as a volunteer commentedPeople here may be interested in:
#2530306: America/Montreal and other linked timezones missing from Default time zone setting
Comment #34
yoroy CreditAttribution: yoroy at Roy Scholten commentedYes please, this looks like a no-brainer improvement. Being able to type the city name to find it is useful but especially the visual grouping makes the whole list a lot easer to read/scan. We tested this in a UX meeting and it works as intended. Nice one!
Comment #35
Gábor HojtsyNitpick: The types of arguments should be documented.
Comment #36
rachel_norfolkIt's a good nitpick Gábor!
Question: Should I add the type to both arguments? The first one might be considered "out of scope" of the issue, given we have not changed it.
Comment #37
Gábor HojtsyIMHO add to both. I reviewed the code otherwise and it look fine other than this nit.
Comment #38
John Cook CreditAttribution: John Cook commentedI've added the types as suggested by Gábor in #35. I've also added a @return comment.
Comment #39
John Cook CreditAttribution: John Cook commentedForgot to set to "Needs review".
Comment #40
rachel_norfolkKeeping progress up to date in Issue Summary...
Now - we need to approve a non-breaking API change. Hmm - how to do that...
Comment #41
Gábor HojtsyI looked at whether bool|NULL would be the correct type here, but |NULL only seems to be used once in core, so probably not.
Otherwise looks good. IMHO a committer will need to decide on the backwards compatible API addition question.
Comment #42
tstoecklerI think this is a slight regression if you want to select such a timezone. I attached some screenshots to make the difference clear.
Before the patch the three timezones from North Dakota are nicely grouped together.
With the patch they are appear along with the rest of the American time zones.
I think this could be fixed fairly simply by changing the
line into
Marking back to "needs review" at least to see what others think. We could either ignore this issue altogether, change it now, or change it in a follow-up. I don't feel strongly either way, but wanted to bring it up, as I don't think it received much attention after @andrewmacpherson brought it up above.
Edit: Actually embed the correct images. (Also make them a appear a bit smaller, sorry for the size)
Comment #43
rachel_norfolkIt is true that @andrewmacpherson raised the query about threee level timezones. We did discuss it but failed to document that discussion very well.
We felt that the threee level timezones were something of a historical quirk of their creation and in many ways were inconsistent with the rest of the timezones, both continent and world wide. People wanting to choose those timezones would be more than aware of their existence and capable of choosing from a list formatted as {continent}/{city}.
If there was a more widespread use of threee level timezones, I think the change would have been justified. I think, in this case, it would be fine to set back to RTBC as is.
Comment #44
John Cook CreditAttribution: John Cook commentedAlso, as @tstoeckler quoted:
So there is also a technical reason behind this.
Comment #45
tstoecklerRe #44: Well as I suggest we could also just keep the "/" separator for those timezones so I do think it's possible to solve this, but #43 is fine with me.
Comment #46
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThe three-part timezones have been nagging at my mind, so I did some appraisal of them.
Re: #45
If we kept the middle parts (e.g. "Argentina/Catamarca") those cities would be difficult to find by type-ahead. We'd be singling out a specific country (Argentina) for a poorer UX, which I don't think is very fair at all.
My method was to run this, via devel/php:
Comment #47
prabhu9484 CreditAttribution: prabhu9484 at gai Technologies Pvt Ltd commentedLets also add a graphical time-zone picker ?
1. I like the Ubuntu 14.04 time-zone setter. The location typing field loads beautifully and accurately
2. The map click also works great. Refer to the attached screen-shot
Also found the Jquery Timezone picker - http://timezonepicker.com/
Comment #48
prabhu9484 CreditAttribution: prabhu9484 at gai Technologies Pvt Ltd commentedOops - forgot to attach the Ubutu 14.04 time-zone setting screen-shot
Comment #49
prabhu9484 CreditAttribution: prabhu9484 at gai Technologies Pvt Ltd commentedAlso found relevant drupal.org projects:
https://www.drupal.org/project/timezone_picker
https://www.drupal.org/project/tzfield
Comment #50
yoroy CreditAttribution: yoroy at Roy Scholten commentedThat would need it's own issue @prabhu9484, this issue is about improving what is there now. Feel free to create a separate issue for creating a graphical time zone picker though!
Comment #51
prabhu9484 CreditAttribution: prabhu9484 at gai Technologies Pvt Ltd commentedMany thanks @yoroy - created https://www.drupal.org/node/2853386 - please review
Comment #52
xjmSo my first reaction on reading the title of this issue was "Bojhan says optgroups are not a good pattern" but I see this issue has usability review from the UX team and signoff from @yoroy, so looks like they were useful here. Thanks!
I am concerned about #42 though. If I want to select a timezone for North Dakota, I would look for North Dakota. Why don't we make it so that it shows "North Dakota/Beluah" instead, listed under the America optgroup?
Comment #53
rachel_norfolk@xjm - did you see the more detailed analysis done by @andrewmacpherson in #46?
The trouble is that North Dakota is an exception. By displaying it, we create something inconsistent. Same could be said for Argentina - different to rest of time zones in continent.
Comment #54
ifrikUnless you know that North Dakota is an exception, you wouldn't look for "North Dakota" but for Beluah because before you come to N there is no indication that this one US state is different then the rest of the countries in the list.
So I would agree with #46: We are now keeping a bad UI for the sake of a few exceptions.
Comment #55
mpdonadioTried to review this, but latest patch doesn't apply.
I think the only proper thing to do is the split just on the first /, and display the remaining portion, eg Indiana/Indianapolis. zoneinfo is fluid. It would also cause ambiguity if we add in the backward data (the links) where there would be duplicates.
I can raise this issue on the TZ mailing list if desired, I don't really participate but I do read it.
Comment #56
rivimeyBeen following from the sidelines since I reviewed the patch. The list of names presented here is very clearly a list of towns/cities. I see no benefit whatsoever in retaining in this list a few places that include a state or country name. You might as well ask why France/Paris is not listed, or New York/New York!
I thought for a while that splitting on the first /, as @mpdonaldo suggested in #55, was a sane compromise, but I now feel that is not true: It merely muddies waters that are relatively clear until that point. And as also noted above (1), the additional level is apparently a deprecated feature of zoneinfo, so unlikely to be included in any new place, and (2) as @andrewmacpherson found in #46 there are no current duplicate places when the middle level is omitted.
@xjm makes a point about 'looking for a place from North Dakota'. Well, why can I not look up my timezone by looking for United Kingdom then? or @DamienMcKenna look up New Hampshire?
Think of it this way. If the base TZ list hadn't had these anomalies, would people be demanding the additional levels, for these particular places and no others? I would guess not.
The argument thus resolves around the possible desire to not trip up a few people who believe from some past experience that their place can be found via their region name and country name, rather than by their region and city name, despite everyone else not doing so. I do not believe that most people in those areas will think like this: they will look at the first items and deduce the correct behaviour from those.
Please, let us get this approved and committed. If we then get complaints we can perhaps review the decision in the light of that actual data.
Comment #57
mpdonadioThe problem is that we are essentially mapping this select to the IANA list, not a list that we are picking.
France/Paris isn't there because the first portion of the identifier is Area (usually continent or ocean) not a country (because geographical lines can change), and the second is Location (usually a city, but sometimes a larger geographic area, typically the name of an island). Location can be compound. Compound locations are here to stay and part of the official database (since at least 2005); they are not deprecated.
Having something like tzselect would be *way* better, but that is not the scope of this issue (but see #2853386: Interactive time-zone picker).
I also think we are misinterpreting the fact that there aren't any duplicates. From the northamerica file
That went into effect in the 2005.10(?) zoneinfo.
So, if we get rid of "Indiana", then we are potentially losing important information, information that the people on the tz mailing list thought was important enough to keep in the database. I looked into the discussion around this, and Paul Eggert told me:
I am not down with the approach of throwing away the middle portion on three-level names. I am somewhat willing to dig in my heels on this...
Fortunately, I think there is an easy solve, to retain the information and to make city lookup easier.
When there is a three-level name, present it as
First Level
-- Third Level (Second Level).
So, 'America/Indiana/Indianapolis' would get rendered out as
City/location search would work by first character, and we keep the middle level for reference.
?
Comment #58
rivimeyHi, thanks for the detailed reply. Your suggested solution did occur to me as well, and I for one would be happy with it.
Comment #59
John Cook CreditAttribution: John Cook as a volunteer commentedI've re-rolled the patch against 8.4.x as it wouldn't apply cleanly as stated by mpdonadio in #55.
I've added the middle section to the text as suggested in #57 so the elements are output as:
If there are multiple Area segments, they are concatenated back together using "/", although there isn't any 4+ segment timezones in the list.
Setting back to "needs review" and removing the "needs re-roll" tag.
Comment #60
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commented@mpdonadio - Thanks for the research.
Yes, this sounds like a good way to deal with these quirks.
Oh wow, this is reassuring. I was worried we might be overlooking a critically important technical reason, but it looks like we can rearrange it for presentation.
Comment #61
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedReview of the patch in #59:
An interdiff wasn't provided, and I got errors when trying to run
interdiff
, so I manually compared the whole patch with the previous on from comment #38.The changes which needed a re-roll are all to do with
array()
syntax which was changed to[]
.The change which brings in the third-level presentation is in this part...
Patch from #38:
Patch from #59:
This works by taking the last part as the city, the first part as the region (optgroup), and includes all remaining parts in brackets after the city name. Bonus points for being robust enough to deal with any number of parts, just in case the tzdata ever gets some 4 level names :-)
Minor nitpick:
join()
is an alias ofimplode()
, so we could change this to the preferred function name. Having said that, we are using a mixture of join and implode in core, and our coding standards don't mention it, so I suppose it isn't a blocker here.Screenshot of the options after patch #59. Amazingly, you can arrange it so Argentine, Indiana, Kentucky, and North Dakota are all in view at once.
Comment #62
ifrikThanks - that looks like a good solution.
Comment #63
mpdonadioDoes this change need test coverage, or is there already a test that ensure that the select contains precisely the same list from timezone_identifiers_list()?
Comment #64
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedack system_time_zones
reveals there are is no test coverage prior to this patch.Note that system_time_zones() does have a step to filter the list from timezone_identifiers_list(), so they're not guaranteed to be the same. (In practice, they all pass the preg_match, so the counts are the same.)
It might be a good idea to test that the array count from system_time_zones() is the same regardless of whether the new
$grouped
parameter is true.Comment #65
lauriiiThis comment looks like a bit redundant
There's an extra space before (
s/boolean/bool
Comment #66
mpdonadioOK, I see that now. That is baggage from Drupal 7 and the supported PHP versions. In PHP 5.3+, you can filter out the backzone data (they added parameters to that timezone_identifiers_list()). Since Drupal 8 is PHP 5.5+, that is essentially a no-op.
I think that would be sufficient to check for regressions, or other weirdness that may appear in the future in zoneinfo.
Comment #67
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedI found some W3C accessibility documentation which supports the proposed UI change!
From the WAI-ARIA Authoring Practices 1.1 (currently a working draft), in the Listbox section:
Now, this section is talking about the WAI-ARIA
listbox
role, rather than HTML<select>
, but the point is essentially the same as we're trying to address here.Comment #68
rachel_norfolkJust a little update of the Issue Summary
Comment #69
benjifisherThanks for the updates to the issue summary, @rachel_norfolk. I think there is work here for a novice, so I will add that tag.
Comment #70
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThe points in #65 are certainly suitable for a novice, and maybe the tests too.
The "needs tests" part is described in #63, #64, #66.
The change record should describe the new
$grouped
parameter forsystem_time_zones()
Comment #71
zerbash CreditAttribution: zerbash commentedWorking on this with @murrow @DrupalConBaltimore2017.
Comment #72
murrow CreditAttribution: murrow commentedSubmitting patch as requested in #65
Comment #73
murrow CreditAttribution: murrow commentedThe interdiff for #72
Comment #74
mpdonadioThis is still Needs Work because #72 fixed things, but we still need test coverage.
Comment #75
zerbash CreditAttribution: zerbash commentedWorking on adding the test.
Comment #76
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThanks @murrow + @zerbash.
Confirmed that patch #72 fixes the minor issues in #65.
Comment #77
murrow CreditAttribution: murrow commented#74 Adding kernel tests for default and grouped use cases in system_time_zones().
I added one test to ensure the existing/default functionality was retained and a second to verify that the grouping override was working as expected.
I am unsure if the test file is in the correct location.
Comment #78
mgiffordComment #79
murrow CreditAttribution: murrow commentedSorry, I posted the wrong interdiff. Proper interdiff attached.
Comment #80
murrow CreditAttribution: murrow commentedComment #81
zerbash CreditAttribution: zerbash commentedComment #82
mpdonadioThanks for the test. The spacing in the new file isn't per the coding standards. When the test runs, there should be an artifact patch to fix all of this.
Nit. Indentation is wrong, and this should all be one line.
We normally don't preface our own functions like this.
Don't think we need the t().
We also need the test described in #64,
.
That will ensure that this does what we think it does and prevent regressions in the future.
I also think we could add assertions that the three-level zones are handled properly (eg, America/Indiana/Indianapolis).
Comment #83
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThanks for working on tests @murrow!
Some feedback about patch #77 (though I am not a testing expert...):
1.
The name of the new parameter is
$grouped
, so the test method names would make more sense to use that in the name.Something like
testSystemTimeZoneGrouped()
andtestSystemTimeZonesUngrouped()
? Don't trust my camelCase though, I often get that wrong.2.
A short docblock comment summarizing what each test method is looking for could help. They are making assertions about array structure and string format. Something like "
Tests the grouped output of system_time_zones().
"? I'm not sure what our ususal style is, so maybe someone else will suggest something better.3.
The 2 test methods in #77 are checking the structure of the return array, but we don't have anything to confirm the counts yet.
In #64 and #66 we also suggested calling grouped and ungrouped calls, to confirm they had the same number of options. (i.e. none were being accidentally excluded by the code that handles $grouped).
Comment #84
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedOops, cross posted review with mpdonadio, some duplicate feedback.
Comment #85
murrow CreditAttribution: murrow commentedThank you. I have updated the tests to include:
I've also added some docblock comments, although I'm having difficulty finding suitable examples. Am happy to take pointers…
Comment #86
rachel_norfolkLoving all this activity!!
Set to Needs Review
Comment #87
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedJust noticed that @murrow has drafted a Change Record too. I'm running out of time for reviewing stuff today, so I'm linking it here for someone else to look at:
https://www.drupal.org/node/2873857
Awesome progress!
Comment #88
murrow CreditAttribution: murrow as a volunteer commentedApologies, I don't think I had the match array test right. We needed to accommodate the nesting and UTC. An update is attached that also cleans out a few errant tabs.
Comment #89
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedIn
testSystemTimeZoneMatch()
you can tally the$grouped_count
more simply witharray_walk_recursive()
which only acts on the leaves of nested arrays.Something like this?
Comment #90
murrow CreditAttribution: murrow as a volunteer commentedOK, that #89 looks more efficient. I've updated the test to reflect this change
Comment #91
murrow CreditAttribution: murrow as a volunteer commentedIs there any chance of having this reviewed soon and completed?
Comment #92
rachel_norfolkThe new patch is applying correctly and providing the expected behaviour during testing via Simplytest.me
I like the new tests - look good structurally.
The test is reporting some code standards errors in the most recent test. They will need resolving but otherwise I'm very happy.
Comment #93
murrow CreditAttribution: murrow as a volunteer commentedThanks @rachel_norfolk. I can see I need to read the test report, even when it says pass. I've aligned the spacing with the Drupal coding requirements and I believe that the attached patch is correct now. Many thanks for your quick response.
Comment #94
rachel_norfolkNo worries - and thanks for not losing heart with it all! It’s worth setting up your local dev to allow code standards checking, rather than waiting for the testbot.
Setting to Needs Review. (I forget this ALL THE TIME!)
Comment #95
rachel_norfolkTiniest of tiny changes to spacing...
Comment #96
benjifisherI suggested to @murrow that he put the tests under
core/modules/system/tests
. Is that the right place for them?I think we need a follow-up issue to update the documentation. One of the screenshots in 3.4. Running the Installer in the D8 User Guide will need to be updated.
Comment #98
mpdonadio#96, the function is provided by the system module, so it should live with all of the other system KTB tests.
I'll try to do a proper review tonight.
Comment #99
benjifisherLooks like a testbot failure, now resolved. Back to NR.
I created a follow-up issue for the documentation: #2875672: Update screenshot and text for timezone selector change in Drupal 8.4.x.
Comment #100
mpdonadioThe new test file should be a holding place for future system TZ coverage and not just this change.
Test coverage itself looks good, just down to little things now.
A bunch of comments are like this.
Should be more generic, like "Test coverage for time zone handling."
Not needed.
Needs trailing period. Should be something like "Tests grouping in system_time_zones()." Don't need the @test
Mirror the above change, but mention non-grouping or something like that.
Similar to above, but for three level grouping. Remember that the first line in the docblock has to be a single line, not exceeding 80 chars.
Add a negative assertion that "America/Indianapolis" doesn't appear.
Add a negative assertion that "America/Indianapolis" doesn't appear.
Single line, not exceeding 80 chars.
Can use assertCount().
Comment #101
murrow CreditAttribution: murrow as a volunteer commentedOK, I believe I have those changes in place now.
Comment #102
murrow CreditAttribution: murrow as a volunteer commentedOK, I must be jet lagged. The test is wrong. I am uploading yet another patch that does work.
Comment #104
mpdonadioComment #105
mpdonadioFirst, thanks to everyone who was working on this issue. Rather than give feedback on the last patch, I thought it would be a good idea to walk through some additional nitpicks.
The first is that I collapsed this into a single test method. We don't need the isolation that individual methods have, so this makes things much faster.
OK, here one of the individual methods is folded into the single method, with a comment about what follows. I also updated the assertion to use one of the helpers.
The assertions that follow can all use the same result set.
OK, this is largely unchanged, just to use the new helpers.
Largely unchanged, but some things have been moved around. See below.
I placed three negative assertions here together explaining what they are doing. These are largely here to make sure that if someone changes system_time_zones() in the future, and get fails here, they will know what was being covered. This partially to make sure that any work in #2530306: America/Montreal and other linked timezones missing from Default time zone setting and #2853386: Interactive time-zone picker doesn't break what we did here.
Comment #106
benjifisherI am adding #2678010: Time zone selection improvement (performance/UX) as a related issue. I am not sure whether that issue should be closed as a duplicate of this one. I do not think this issue addresses caching for better performance.
I was going to add a follow-up issue to review all calls to
system_time_zones
in core, but maybe that has already been done as part of this issue:So "system_time_zones" appears twice in
system.module
and once in each of the other files. It looks as though all uses have been updated exceptUserUpdate7002.php
andUser.php
. After looking at those for a minute, I think we want to leave them alone.Comment #107
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commented@benjifisher: thanks for finding the other issue. I made a comparison of the two proposed approaches over at comment #21 of #2678010: Time zone selection improvement (performance/UX).
It's not clear that the issues duplicate each other, but it's clear we can't do both :-) The other issue discusses a few formats, but hasn't got answers to them all yet. On the whole, I think this one is further developed, and type-ahead is a great accessibility win.
Agreed, those aren't about presenting a UI widget, they deal with validation.
Comment #108
brettwilson CreditAttribution: brettwilson at Redfin Solutions, LLC commentedPatch still applies cleanly to 8.4.x. Functional testing indicates it's still working. See attached screenshots before and after applied patch. Latest round of automated tests pass. It looks like the last thing to do is for someone to code review the automated tests, so removing the novice tag.
Comment #109
brettwilson CreditAttribution: brettwilson at Redfin Solutions, LLC commentedFor what it's worth this also applies cleanly to 8.3.x.
Comment #110
rachel_norfolkRetesting simply to see any code style comments - I seem to have broken phpcs on my machine. Again.
Comment #111
rachel_norfolkNo tests code style comments logged \o/
I suppose there will always be a risk that, if Dar es Salaam is somehow removed from PHP, our tests will fail (same goes for Indiana). Of course, I like to think this is very unlikely!
I've updated the Issue Summary to link to the proposed CR, which shows we are only adding to the API, and I'm going to set this to RTBC. Will get it in the right hands.
Comment #112
mpdonadioI monitor the TZ mailing list. We'll have advance warning about this if it ever happens, and we'll see it in the PHP-dev branch testing before we ever have a failure in stable bots. I also think that we won't have a problem with this. https://github.com/eggert/tz/blob/master/Theory#L48-L169 has more background about this.
Comment #113
droplet CreditAttribution: droplet commentedLooks neater but not better in functionality.
1. When I scroll it, it's very easy to bypass the Group Heading. If I looking it alphabetically, I will not find my target. And for the most of sites, there're no grouped. They will press keyboard to locate to prefix first. The old style I still knew where I am.
(I won't use down and up arrow to select it but use Mouse hold and scroll or Mouse Wheel.)
2. I think many people don't know which Oceans they're..
and if its only aim to timezone, I think we should add these style to the list. (either before or after the list items)
Comment #114
rachel_norfolkI’m not sure I understand point 1 but point 2 is interesting and something we certainly could do, alothiugh id like to see the time zone offset AFTER the city name, so as to preserve the ability to type–ahead the city name.
Comment #115
John Cook CreditAttribution: John Cook at Creode commentedI believe what droplet is getting at is that sometimes you can get lost in the list. Using andrewmacpherson's image from #61:
Unless you were familiar with the locations, it may take you a while to find out you were in the "America" section.
Adding offsets would be a bit of work. A new DateTimeZone object would need to be created for each timezone and them getOffset would need to be called on each one. Don't forget that the offset for a city can change - eg. GMT(+0:00)/BST(+1:00) for Europe/London - and this change happens at different times for different cities.
Comment #116
John Cook CreditAttribution: John Cook at Creode commentedAddendum to offsets.
This may be my bias, but I think that people use the short code for the time zone rather than an offset; PST, CEST, GMT etc.
After a little playing I've got this which shows the long name (Europe/Andorra) and the short code (CET / CEST) depending on the current time.
The output also shows offsets for the time zone if a short code isn't available.
Comment #117
John Cook CreditAttribution: John Cook at Creode commentedAssuming that we're going to add offsets / short codes, what would the formatting in the list be?
I like "
{city}(, {area})* \({tzc}\)
" orComment #118
rachel_norfolkI’m liking the final example.
As long as the city name comes first, we still get the benefits of type-ahead. I can see how adding the timezone will act as a good indicator for where in the list someone is.
I imagine this will have an effect on our tests. #hint
Comment #119
murrow CreditAttribution: murrow as a volunteer commentedI like the idea of the short codes and will update the tests tomorrow (I'm now at 23:16 NZT myself).
Comment #120
droplet CreditAttribution: droplet commentedOr as simple as this:
[#2873857]
and I thought we could add 3rd arg to accept a callback function for "List sort order". If my site targeted to Asia, I want it shown first. Or in a different language, that will not sort by A-Z.
EDITED: But of course, we still able to sort it again after function calls now.
Comment #121
mpdonadio#116, that isn't really correct. The zoneinfo maintainers are moving away from assigning zone names to places that historically haven't had them, and they have started to go away in newer versions of the database (we had a critical testing bug as a result).
The biggest problem with this is that the function will be time dependant and it returns an array, not a render array. So, the only way to make this work reliably is to add a max-age=0 everywhere it gets used, and I think this would also potentially cause BC problems with contrib.
Adding the offset before / after the name may help (it's somewhat common elsewhere), but I would worry about the screen reader clutter and we also have the cache problem, and the fact that people will have to remember whether they are currently in DST or not.
People should also not really being using the manual, explicitly offsets (other than UTC itself) unless they really know what they are doing, even if they know they are somewhere that doesn't observe DST because laws change.
Bottom line is that no matter what we do, we are going to have a sub-optimal solution. The root cause of this problem is that huge selects have horrible UX no matter how much lipstick you put on the pig. We are trying to fix this with the data, but the problem is the UI element itself. JS solutions like Chosen and Select2 help a lot with this. (I really think Chosen should be baked into core...).
The zoneinfo output list is not really supposed to be used on its own as the sole way for users to choose their time zone. People on unixy systems can run tzselect to see one way that to guide people through this.
I think for the scope of this issue we commit the current patch that we RTBCed, and then figure out a interactive solution in #2853386: Interactive time-zone picker. That will be better for all in the long run.
Comment #122
droplet CreditAttribution: droplet commentedthe scope assumed everyone using the keyboard to select. And if so, why not sorted by A-Z (by default). A-Z implied 26 grounded sections
There are no multiple-level dropdowns, it's easier to locate A-Z 26 grounded sections than 7 continents.
If your City does not on the list, you still have to go back to the basic.
#120 GIF, I actually select the item that way and usually that fast until to range I looking for.
Comment #123
mpdonadioAre you saying alpha by "location (location), area", eg "Indianapolis (Indiana), America"? I'm not sure if that really improves things when the location (usually city) isn't where you live. I live in Philadelphia, USA; that's not in the list. With that, I would have to scroll/arrow around both up and down looking for other cities near me (Baltimore, Washington, New York, Boston), but I would have the non-America zones intermingled. At least with the grouping, I don't have to search as much.
Comment #124
larowlanUpdating issue credits - adding
-benjifisher for doing detective work and issue triage
-martin107 for a CS reroll
-yoroy for a UX review
-laurii for a review asking for more tests
Comment #125
rachel_norfolkIn terms of meeting to original Problem / Motivation, the current patch is the best
I’m setting back to RTBC - I’m happy for work to take place on incorporating offset times directly or graphical timezone pickers to take place in follow-up issues but it’s really out of scope here.
Also, specifically stating that in the Issue Summary. I should have done that earlier.
Comment #126
ifrikThis should be mentioned in the 8.4 release notes if it gets committed in time.
Comment #127
yoroy CreditAttribution: yoroy at Roy Scholten commented@mpdonadio in #121:
This is exactly right. As long as we're changing things within the current ui element of a select list, we're only making slightly different trade-offs.
What I think is important to keep in mind here is that in both cases where this element is presented (installer and configuration pages), there is already a default value present.
In my case it shows Berlin. Amsterdam would have been closer since I'm in NL. When I open the select list to change it to Amsterdam, the amount of "travel" I have to do to find it is the same in both current situtation and in the proposed patch here. But the patch version is much more easy to read and understand.
I don't think that losing context (which region you're in) is as big a risk or flaw than the hard to read list we have now. That the patch makes it easier to type and find is a relatively small win. Not many people know this, but maybe that percentage is a bit higher in the group that actually installs and configures Drupal sites :)
All in all, I think this is ok to commit, with the understanding that it is a relatively small optimization. A better time zone picker design would have to break out of the single select list. Oh, look!
Comment #129
larowlanThanks @yoroy for another UX review - well articulated.
Committed as 9868bf9 and pushed to 8.4.x.
Thanks everyone for all the efforts on this, I realise it's been a long time in the making.
Published the change record.
See everyone over in #2853386: Interactive time-zone picker - let's keep up the momentum.
Comment #130
benjifisherI changed the follow-up issue for documentation from Postponed to Active: #2875672: Update screenshot and text for timezone selector change in Drupal 8.4.x.
Comment #131
mondrakeI think this has created a new test failure on PHP 7.1
Fatal error: Cannot use lexical variable $grouped_count as a parameter name in /var/www/html/core/modules/system/tests/src/Kernel/Timezone/TimezoneTest.php on line 57
should be reverted?
See https://www.drupal.org/pift-ci-job/722568
Comment #132
mpdonadioSent message to @larowlan about this; think this should be a quick fix.
Comment #133
rachel_norfolkLooks like quite a few php projects hitting the same thing with php71
Thanks for taking this up, mpdonadio
Comment #134
mpdonadioSince this is causing test environment fails in non-dev versions, this is a Critical until it is reverted. Starting on a fix now.
Comment #135
mpdonadioPretty sure this will work, https://3v4l.org/8Pgsp
Patch is against HEAD. Once we revert, it's a small change to #104.
Comment #136
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedLGTM
Comment #138
larowlanThanks @mpdonadio for the quick turnaround.
I didn't get your message though? (Just saw this issue pop up in email).
Comment #139
xjmRestoring the original priority. Thanks for the hotfix!