Automattic / sensei

Sensei LMS - Online Courses, Quizzes, & Learning
https://senseilms.com
GNU General Public License v2.0
540 stars 198 forks source link

Student Management: Notices should be full width #5094

Open m1r0 opened 2 years ago

m1r0 commented 2 years ago

Steps to Reproduce

  1. Have some notices in the admin panel.
  2. Go to Sensei LMS -> Students.

What I Expected

The notices should be full width.

What Happened Instead

The notices are half-width.

PHP / WordPress / Sensei LMS version

PHP: 7.0 WordPress: 5.9.3 Sensei LMS: 4.4.0

Browser / OS version

Browser: Chrome OS: MacOS

Screenshot / Video

Screenshot on 2022-05-04 at 17-42-11
Bones5 commented 2 years ago

I've had a look into this, it appears to be more to do with where admin notices are printed in the DOM than styling.

Different admin pages are printing in different places

image image image

I'm finding it difficult to control where the admin notices action fires. There are hacks such as mimicking the end of wp-header by adding<hr class="wp-header-end"> to templates but it's results are inconsistent and can print notices twice.

Happy to work on a PR but currently unable to find a proper fix, hope this is useful.

m1r0 commented 2 years ago

Thanks, @Bones5! That pointed me in the right direction.

Yeah, this looks like a tricky one to solve.

To add some more context - notices are placed after the .wp-header-end or if that is not present, after the first H1 (source). So that complicates things.

Maybe we should change how the header/navigation is structured to avoid noticed placed inside the navigation holder. Another option would be to add a .wp-header-end in the right place.

Bones5 commented 2 years ago

Thanks for that @m1r0, I couldn't find that detail about the placement in the PHP, I knew it would be somewhere, I didn't realise it was being controlled in the JS.

Looking at core admin pages such as the Plugins page, the standard way to do this does appear to be to add <hr class="wp-header-end"> where required.

I will look in to adding this after the navigation section of admin pages and see how we get on.