Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown menu not working anymore #371

Open
kettner opened this issue Jan 12, 2023 · 10 comments
Open

Dropdown menu not working anymore #371

kettner opened this issue Jan 12, 2023 · 10 comments
Labels

Comments

@kettner
Copy link

kettner commented Jan 12, 2023

Hi,
The chameleon stickhead dropdown menubar stopped working for me with the upgrade from MW1:38.1 to 1.38.5. The current skin version I'm running is 4.1.0; bootstrap 4.6.0. See also: https://csdms.colorado.edu/wiki/Special:Version

The menus on the dropdown bar all point to the page you are on, with a "#" behind it. So if you are on https://csdms.colorado.edu/wiki/Special:Version, the menu bar links would point to https://csdms.colorado.edu/wiki/Special:Version#.

Any idea what is causing this?
Thanks for your help in advance,
Albert

@kettner
Copy link
Author

kettner commented Jan 12, 2023

An update on this issue: I downgraded to MW1.38.1 as the CSDMS mediawiki is 'operational'. So the problem won't show anymore when going to the above indicated links. However, I would like to update the MW so the security patches are installed, so I'm still interested in what could have gone wrong.
Thanks,
Albert

@malberts
Copy link
Contributor

Ah, I guess I was a bit slow. I couldn't see what problem you were describing.

Just to confirm:

  • Did the dropdowns still open correctly?
  • And once opened, did all the items inside the dropdown have the #-links?

The main links (dropdown triggers) should have those #-links because those links don't actually open any pages. I'm not immediately sure if there were additional deprecations or other breaking changes between MW 1.38.1 and 1.38.5 that might've broken the dropdown links.

There's a chance that some issues might've been fixed on the Chameleon master branch after the 4.1.0 release, but I cannot confirm right now.

@malberts malberts added the bug label Jan 12, 2023
@kettner
Copy link
Author

kettner commented Jan 12, 2023

Thank you for the prompt response @malberts (not slow at all)!
The dropdown menus didn't open, so only the main menu items were visible.

I updated the skin through composer using the following settings in composer-local:
"mediawiki/bootstrap":"~4.0",
"mediawiki/chameleon-skin": "4.1.x",

So I assume it downloaded the latest from the master branch, is that correct?

Also, to show potential errors in the browser I included the following in LocalSettings.php:
error_reporting( E_ALL );
ini_set( 'display_errors', 1 );

Unfortunately no errors where showing when loading any page or when clicking on the menu items.
Thanks for your thoughts!!

@malberts
Copy link
Contributor

I checked MW 1.39.1 with both Chameleon 4.1.0 and master and the dropdown opened. I suspect something broke your JavaScript. This can be because of another extension's JS (perhaps due to a MW change). There's also a chance that some PHP error or deprecation notice got injected into the JS when MW's ResourceLoader loads the JS. You could then end up with invalid JS breaking the dropdown.

To debug this you'll need to somehow run the later version of MW. Then look in your browser's Developer Tools Console to see if there is a JavaScript error. This won't be shown on the page because it's not a PHP error that comes up during page load.

Will it be possible to host a non-production copy of your wiki with the newer MW version?

"mediawiki/chameleon-skin": "4.1.x",
So I assume it downloaded the latest from the master branch, is that correct?

No, you need ask for it explicitly. Change "4.1.x" to "dev-master", however I don't think that is actually the solution here, because the dropdown was fine for me with 4.1.0 and MW 1.39.

@kettner
Copy link
Author

kettner commented Jan 13, 2023

Thank you @malberts, I'll try to investigate this a bit further by looking into the web browser developer tools for the JS errors, reinstalling MW1.38.5. I can't move to MW1.39.x because of the PHP version we are currently running. I'll report back if I find something useful. Thanks!

@kettner
Copy link
Author

kettner commented Jan 15, 2023

I upgraded to MW 1.38.4. The problem doesn't occur when doing so. I do get a warning message, which is the following:
"​ This page is using the deprecated ResourceLoader module "skins.chameleon".
[1.37] The use of the content feature with ResourceLoaderSkinModule is deprecated. Use content-media instead. [1.37] The use of the legacy feature with ResourceLoaderSkinModule is deprecated(T89981). More information can be found at [[mw:Manual:ResourceLoaderSkinModule]]. "

When upgrading to MW 1.38.5, I get the following error in the browser toolkit:
"Refused to execute script from 'https://csdms.colorado.edu/csdms_wiki/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=chameleon' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled"

So it seems that server settings (strict MIME type checking) are triggering the error. Should the MIME type be defined as "js" for one of the chameleon files (not sure which one though......)?

@malberts
Copy link
Contributor

malberts commented Jan 15, 2023

I vaguely recall seeing that MIME message once, but I don't remember if it had anything to do with Chameleon or even what caused/fixed it. I'm pretty sure there is no need to change any server settings.

That deprecation notice shouldn't cause a problem.

There's one more thing to check: When you get that error message, open the script link. I suspect there is some non-JS in the JS ouput, which might trigger the MIME type mismatch. This could be caused by some PHP message (error or deprecation) slipping into the ResourceLoader output, but not into the page itself.

@malberts
Copy link
Contributor

I just ran into a similar MIME type error on a wiki using Semantic MediaWiki. The ResourceLoader URLs for CSS and JavaScript all show an SMW upgrade error if you open them manually (i.e. they're now returning HTML instead of what they were supposed to). The wiki's main page does not show any errors, besides CSS being broken. So now I'm pretty sure you have a similar case where an error is getting into the resource URL but is not shown on the wiki page itself.

@kettner
Copy link
Author

kettner commented Jan 17, 2023

Thanks for letting me know @malberts. I didn't have a chance yet to re-install MW1.38.5, so have not been able to reproduce and further analyze the error, which does not appear in version MW1.38.4 (https://csdms.colorado.edu/wiki/Special:Version)

So from your email, it looks like SMW is causing the problem. Did you report the bug already to the SMW group? Reading their website, I think they have scheduled a 4.0.3 release in the coming month...... Would be great if a bugfix for this would be included as well. Thanks!

@malberts
Copy link
Contributor

Sorry, I was a bit unclear. In my case this was from not running the SMW update script. It's not an SMW or Chameleon bug, but rather an example of what could cause the MIME type error (i.e. HTML is somehow leaking into the JS/CSS resource).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants