Mejora del cambio automático de modos móvil/escritorio

Historically, Discourse has had two distinct views for mobile and desktop. Over the years, these have tended to converge towards more modern viewport-width-based design. Those modern patterns are documented here.

In the latest version of Discourse, we are replacing the user-agent-based detection of mobile/desktop modes, in favour of a purely viewport-width-based solution. This will make things much more intuitive for users and developers. In particular, this is a significant improvement for tablet users, who never really fit into either of the old modes.

All existing code which references mobileView/desktopView in templates/JS, or .mobile-view/.desktop-view in CSS, will continue to work. Those JS booleans and CSS classes are now automatically changed based on the width of the browser.

Similarly, dedicated mobile/desktop stylesheets are now loaded with a media= attribute, so that they only apply to specific viewport widths.

Essentially: “mobile mode” is now an alias for “browser width is less than 40rem”.

Initially, this change can be reverted by toggling the “viewport based mobile mode” site setting to false. However, this setting will be removed in the near future. So if you find the need to use it, please let us know the reason.

As always, please let us know if you have any questions or feedback below.

9 Me gusta