craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 637 forks source link

[5.x]: Resetting the view in an element index to defaults should reset to the default view mode #16111

Closed MoritzLost closed 1 week ago

MoritzLost commented 1 week ago

What happened?

Description

As of Craft 5.5, it's possible to set a Default View Mode for all sources in element indexes. Clicking on Use defaults in the view dropdown resets all the visible columns and the sort order to the defaults defined for that source. But it will not reset the view mode to the selected default view mode.

Steps to reproduce

  1. Set the default view mode to cards for any entry source.
  2. Switch the view to table using the buttons next to the view menu on the upper right.
  3. Click on the view dropdown and click on Use defaults.
  4. The view will not reset to cards mode, but stay in table mode.

Expected behavior

Resetting the view to defaults should reset all view settings, including the view mode, to the default settings.

Actual behavior

The view mode is not reset along with all other view settings.

Craft CMS version

5.5.0.1

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

-

brandonkelly commented 1 week ago

That’s how it was originally PR’d, but in practice it felt awkward to me that the view mode would change when you press “Use defaults”, since everything else in the HUD is view mode-dependent. For example, the Table Columns checkboxes aren’t visible when the Cards view is selected. So if the Cards view was the default mode, and table view was selected, pressing “Use defaults” would (unexpectedly IMO) switch you to card view, and hide the Table Columns setting, which is jarring.

MoritzLost commented 6 days ago

@brandonkelly Fair enough, that makes sense 👍