Problem/Motivation

As described in #3468866: UX optimizations to Date and Time entry fields, there is a common pattern in calendar software to show duration options in an overlay, to make it more obvious what end time will be created. As described by Jakob's Law of Usability, the use of familiar patterns improves user experience.

Here is how the interface currently looks, with the duration as a separate dropdown:

By contrast, here is an example of the Google Calendar interface:

Proposed resolution

Implement a similar pattern in the Smart Date widget. Ensure that the implementation includes keyboard navigation and other accessibility considerations.

Here is an example of how the Smart Date interface looks with the changes in the current MR:

Issue fork smart_date-3472863

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mandclu created an issue. See original summary.

mandclu’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new84.99 KB

Here's a preview of how the updated widget looks, based on the MR

ckrina’s picture

“there is a common pattern in calendar software to show duration options in an overlay” is not a good enough reason to merge this into Drupal CMS, just a good enough reason to test it and evaluate if we want it.

I'd love that, if possible UX or UI improvements are identified, we highlight them first and discuss them, before assuming they are correct and merging them. Because as a consequence you'll start building things on top of that, others reusing them, and then changing things will be a headache.

So I'd recommend not merging this, but first test it to make sure it's an improvement.

mandclu’s picture

Status: Needs review » Needs work

Based on the discussions here and in Drupal slack, I'm going to update this to only use the new overlay if the site builder has opted into it in the formatter settings, and I will mark it as experimental

mandclu’s picture

Status: Needs work » Needs review
mandclu’s picture

StatusFileSize
new88.81 KB
new201.48 KB

Here's an updated look at how the overlay is formatted, now entirely with CSS, using separate spans for the duration and related end time.

Also, the changes won't be visible unless this new configuration is opted-into.

tirupati_singh’s picture

Status: Needs review » Needs work
StatusFileSize
new35.27 KB
new15.66 KB
new44.1 KB
new27.34 KB
new102.89 KB

Hi @mandclu, I've applied the provided MR as a patch and it applied cleanly with no errors. After applying the patch Use an overlay to display duration options. - EXPERIMENTAL option is now being shown in smart_date field widget. When enabling the new overlay display duration, duration is shown between the time in the node edit page. However, there's a spacing/alignment issue in the overlay as shown in the attached screenshot. The extra spaces issue can be resolved if width: 3.75rem; is removed from the class .smart-date--duration-list--time. After removing the extra space is not visible and the time duration is displayed properly. I've attached screenshots of before and after fixes for your reference. As the design issue is present hence moving the issue status to Needs work.

Thanks!

mandclu’s picture

Assigned: Unassigned » mandclu

@tirupati_singh Thank you for the feedback. The challenge underlying your feedback is that this widget needs to accommodate parts of the world that display time in a 12-hour format (e.g. 8:47pm) and the more widely used 24-hour format (e.g. 20:47). You can probably guess which of these I typically use ;-)

I believe the code can be updated to accommodate both properly. I can work on this.

mandclu’s picture

Assigned: mandclu » Unassigned
Status: Needs work » Needs review

The updated MR should only apply the 12h formatting (notably, the wider width) if needed. Please test.

tirupati_singh’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new21.86 KB

Hi @mandclu, now I can confirm that the styling issue for the duration has been fixed. I've tested the overlay duration for both 12h and 24h formatting and the overlay design is working perfectly. I'm attaching the screenshots for your reference. RTBC.

Thanks!

mandclu’s picture

Issue summary: View changes

Updated issue summary.

mandclu’s picture

Issue summary: View changes
StatusFileSize
new70.6 KB

More IS updates.

mandclu’s picture

mandclu’s picture

Version: 4.1.x-dev » 4.2.x-dev

Updated to target a new 4.2.x branch.

  • mandclu committed 5c6657e0 on 4.2.x
    Issue #3472863 by mandclu, tirupati_singh: Show duration options in an...
mandclu’s picture

Status: Reviewed & tested by the community » Fixed

Merged in, and will include in a beta release for the 4.2.x branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.