JoryHogeveen / off-canvas-sidebars

This plugin will add various options to implement off-canvas sidebars in your WordPress theme based on the Slidebars jQuery plugin.
GNU General Public License v2.0
14 stars 4 forks source link

Invalid HTML markup in off-canvas sidebars: widgets wrapped in li elements as children of a div #88

Closed diegocanal closed 4 years ago

diegocanal commented 4 years ago

Describe the bug

In off-canvas sidebars the widgets are output wrapped in <li> HTML elements, but not as children of a <ul>, <ol>, or <menu> element –or the obsolete <dir> element–, which is invalid HTML markup (reference in MDN).

Steps to reproduce the behavior:

  1. Add a off-canvas sidebar.
  2. Add a couple of widgets inside the sidebar.
  3. Inspect the code in dev tools to see the <li> elements wrapping the widgets.

Expected behavior

In my opinion, the widgets should not be output wrapped in <li> elements, <div> seems to me semantically more neutral and appropriate.

Screenshots

Screenshot 2020-05-12 at 18 47 40

Specifications

JoryHogeveen commented 4 years ago

Hello @diegocanal

You can change this through the ocs_register_sidebar_args filter to change it according to your theme. WordPress by default uses <li> elements for widgets (no idea why...) so I'm trying not to change to much in WordPress defaults. However, in this case I do agree that it might be better for me to overwrite this default since the sidebars will never be list items in my case I suppose.

JoryHogeveen commented 4 years ago

I've added a new commit to the dev branch (next update) that will fix this: https://github.com/JoryHogeveen/off-canvas-sidebars/commit/c1f81ffaf1bf3f1ff7157aaa43479b100c91486e

diegocanal commented 4 years ago

Thanks @JoryHogeveen for your superfast reaction.

I'm not a programmer so figuring out how to solve it using the filter would have taken me a while. Your new commit has saved me a lot time.

I love your plugin. Keep up with the good work!

JoryHogeveen commented 4 years ago

Hi @diegocanal No problem! And thanks for your review! Cheers, Jory