danneu / MediaWiki-DarkMode

5 stars 0 forks source link

Timeless Skin #1

Open Gunnar-GO opened 3 years ago

Gunnar-GO commented 3 years ago

In Timeless the top bar will be moved by ~47 px from TOP if in dark mode. A behavior that doesn't appear in the original extension.

danneu commented 3 years ago

Thanks. It may be due to the "*" character I add to the "toggle dark mode" text to indicate when it's turned on. I will have to look.

1over137 commented 3 years ago

I confirm this issue too. Do you have any workarounds for now?

1over137 commented 3 years ago

Also the issue only appears when logged in. When anonymous the issue manifests a bit differently, with the content having too much top padding and leaving weird blank space

Gunnar-GO commented 3 years ago

@danneu , i commented out the added *, no difference.

the header line not uses the fixed-statement. sadly it isn't overwritten so the problem lays at another position.

danneu commented 3 years ago

I looked. It's caused by:

body.darkmode {
    filter: invert(1) hue-rotate(180deg);
}

Almost any value for filter will introduce the gap. Weird. Will investigate.

Looks like it's this quirk: https://stackoverflow.com/questions/52937708/why-does-applying-a-css-filter-on-the-parent-break-the-child-positioning

danneu commented 3 years ago

A targeted patch seemed like a good enough solution: https://github.com/danneu/MediaWiki-DarkMode/commit/53452fb1b764f1f5c9b145fcf4a42d3189af7142

Looks like there are some more fixed components (notification?) that introduce some other instances of this problem I can fix.

Edit: I couldn't reproduce the issue I thought I saw. Anyways, feel free to report more issues as they come up.

arddhu-hub commented 3 years ago

I am having the same issue here. I tried to use your patch but it not worked.

danneu commented 3 years ago

@arddhu-hub Hmm, I will have to take another look then.

Until then, I suppose you can double-check for me that the old unpatched CSS file isn't being served from cache.

arddhu-hub commented 3 years ago

Did checked that, my site is wiki.runeterra.org if you want to take a look. It only happens when someone logged togle it.

Em ter., 29 de dez. de 2020 às 00:24, Dan notifications@github.com escreveu:

@arddhu-hub https://github.com/arddhu-hub Hmm, I will have to take another look then.

Until then, I suppose you can double-check for me that the old unpatched CSS file isn't being served from cache.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/danneu/MediaWiki-DarkMode/issues/1#issuecomment-751932878, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARQN2AIK4MZSAAXR6LEOOALSXFDWFANCNFSM4UICUNPA .

danneu commented 3 years ago

This is embarrassing, but my fix doesn't work. It doesn't even target the right element, nor would it even work if it did.

I was too hasty and wasn't testing what I thought I was.

I have an idea for a fix that I'm testing right now.

arddhu-hub commented 3 years ago

No problem, if you need to test in somewhere else, just let me know.

Em qui., 31 de dez. de 2020 às 01:57, Dan notifications@github.com escreveu:

This is embarrassing, but my fix doesn't work. It doesn't even target the right element, nor would it even work if it did.

I was too hasty and wasn't testing what I thought I was.

I have an idea for a fix that I'm testing right now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/danneu/MediaWiki-DarkMode/issues/1#issuecomment-752843799, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARQN2AO6PWC3C5DWMC3BHIDSXQAE3ANCNFSM4UICUNPA .

danneu commented 3 years ago

One elegant fix is to apply the CSS filter to <html> instead of <body>, as filter doesn't impact position: fixed when applied to the root element.

However, this is only possible with MediaWiki's API as of v1.35 (released July 2020). Are you on that version?

I have some hack ideas for earlier MediaWiki versions, but they would take me longer to test.

arddhu-hub commented 3 years ago

No, I am at 1.34.1

Em qui., 31 de dez. de 2020 às 03:12, Dan notifications@github.com escreveu:

One elegant fix is to apply the CSS filter to instead of , as filter doesn't impact position: fixed when applied to the root element.

However, this is only possible with MediaWiki's API as of v1.35 (released July 2020). Are you on that version?

I have some hack ideas for earlier MediaWiki versions, but they would take me longer to test.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/danneu/MediaWiki-DarkMode/issues/1#issuecomment-752858297, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARQN2AIMJZKBPUPZBHVMOMDSXQI4RANCNFSM4UICUNPA .

Gunnar-GO commented 3 years ago

i am have a 1.35 test-instance. i can run try a try if you want.

danneu commented 3 years ago

I don't have time anytime soon, but if you want to try this hack out yourself:

I wrote this from my phone and mostly memory so realize that this might not be perfect, but this is the general gist.

ghost commented 1 year ago

@danneu your extension is not working whenever I try it.

MediaWiki internal error.

Original exception: [f090865409d8a5ad4c826ba5] /index.php/Main_Page Error: Call to undefined method User::isLoggedIn() Backtrace: from /home/allajwzo/wiki.allan.network/extensions/DarkMode/includes/Hooks.php(35)

0 /home/allajwzo/wiki.allan.network/includes/HookContainer/HookContainer.php(338): MediaWiki\Extension\DarkMode\Hooks::onPersonalUrls(array, Title, SkinMustache)

1 /home/allajwzo/wiki.allan.network/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)

2 /home/allajwzo/wiki.allan.network/includes/HookContainer/HookRunner.php(3006): MediaWiki\HookContainer\HookContainer->run(string, array, array)

3 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(571): MediaWiki\HookContainer\HookRunner->onPersonalUrls(array, Title, SkinMustache)

4 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(1252): SkinTemplate->buildPersonalUrls(boolean)

5 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(782): SkinTemplate->buildContentNavigationUrlsInternal()

6 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(202): SkinTemplate->getPortletsTemplateData()

7 /home/allajwzo/wiki.allan.network/includes/skins/SkinMustache.php(81): SkinTemplate->getTemplateData()

8 /home/allajwzo/wiki.allan.network/includes/skins/SkinMustache.php(58): SkinMustache->getTemplateData()

9 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(150): SkinMustache->generateHTML()

10 /home/allajwzo/wiki.allan.network/includes/OutputPage.php(2807): SkinTemplate->outputPage()

11 /home/allajwzo/wiki.allan.network/includes/MediaWiki.php(926): OutputPage->output(boolean)

12 /home/allajwzo/wiki.allan.network/includes/MediaWiki.php(939): MediaWiki::{closure}()

13 /home/allajwzo/wiki.allan.network/includes/MediaWiki.php(563): MediaWiki->main()

14 /home/allajwzo/wiki.allan.network/index.php(53): MediaWiki->run()

15 /home/allajwzo/wiki.allan.network/index.php(46): wfIndexMain()

16 {main}

Exception caught inside exception handler: [f090865409d8a5ad4c826ba5] /index.php/Main_Page Error: Call to undefined method User::isLoggedIn() Backtrace: from /home/allajwzo/wiki.allan.network/extensions/DarkMode/includes/Hooks.php(35)

0 /home/allajwzo/wiki.allan.network/includes/HookContainer/HookContainer.php(338): MediaWiki\Extension\DarkMode\Hooks::onPersonalUrls(array, Title, SkinMustache)

1 /home/allajwzo/wiki.allan.network/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)

2 /home/allajwzo/wiki.allan.network/includes/HookContainer/HookRunner.php(3006): MediaWiki\HookContainer\HookContainer->run(string, array, array)

3 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(571): MediaWiki\HookContainer\HookRunner->onPersonalUrls(array, Title, SkinMustache)

4 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(1252): SkinTemplate->buildPersonalUrls(boolean)

5 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(782): SkinTemplate->buildContentNavigationUrlsInternal()

6 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(202): SkinTemplate->getPortletsTemplateData()

7 /home/allajwzo/wiki.allan.network/includes/skins/SkinMustache.php(81): SkinTemplate->getTemplateData()

8 /home/allajwzo/wiki.allan.network/includes/skins/SkinMustache.php(58): SkinMustache->getTemplateData()

9 /home/allajwzo/wiki.allan.network/includes/skins/SkinTemplate.php(150): SkinMustache->generateHTML()

10 /home/allajwzo/wiki.allan.network/includes/OutputPage.php(2807): SkinTemplate->outputPage()

11 /home/allajwzo/wiki.allan.network/includes/exception/MWExceptionRenderer.php(157): OutputPage->output()

12 /home/allajwzo/wiki.allan.network/includes/exception/MWExceptionRenderer.php(76): MWExceptionRenderer::reportHTML(Error)

13 /home/allajwzo/wiki.allan.network/includes/exception/MWExceptionHandler.php(107): MWExceptionRenderer::output(Error, integer)

14 /home/allajwzo/wiki.allan.network/includes/exception/MWExceptionHandler.php(202): MWExceptionHandler::report(Error)

15 /home/allajwzo/wiki.allan.network/includes/MediaWiki.php(585): MWExceptionHandler::handleException(Error, string)

16 /home/allajwzo/wiki.allan.network/index.php(53): MediaWiki->run()

17 /home/allajwzo/wiki.allan.network/index.php(46): wfIndexMain()

18 {main}