WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 20 months ago

#29159 new defect (bug)

user-agent checking is removing visual editor in function user_can_richedit

Reported by: vmuryginIB Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.0
Component: Editor Keywords: reporter-feedback
Focuses: Cc:

Description

user-agent checking is removing visual editor in function user_can_richedit. It took us many days to find a problem, which is described here: http://www.benjaminhorn.se/code/wordpress-visual-editor-not-visible-because-of-user-agent-sniffing/

It is not sensible to use user-agent as a check whether to show visual editor. Hopefully this check can be amended or removed in future WP versions.

There are various hosting environments where this check fails. Plus you would constantly need to manually add new strings over time.

We need to write plugins or theme hacks to circumvent this problem (that is after spending days of struggling to pinpoint the problem).

Change History (6)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Editor
  • Version changed from 3.9.1 to 2.0

Introduced in [3283], changed in [4210], [4417], [5425], [18963], [19936], [20417], [20990].

#2 @nacin
4 years ago

What's the user agent that failed for you?

#3 @azaozz
4 years ago

From the post linked in the ticket:

"This usually won’t be a problem, but if you have your frontend servers behind a proxy or load balancer that strips the user agent..."

WordPress has to detect the user agent to properly output the textarea content depending on which editor is loaded first. It also doesn't make sense to load TinyMCE in browsers that don't support it.

It is possible to add an exception in user_can_richedit() for this particular case. However the user agent is used in several other places to adjust the output, most notably in wp_is_mobile(). It is not possible to make the right assumption in these cases.

#4 @iseulde
3 years ago

  • Keywords reporter-feedback added

#5 @mcfedr
3 years ago

Seeing similar problems because I am hosting wordpress behind Amazon CloudFront. For caching reasons there is no user-agent header and I have to patch the function to always return true.

How many browsers don't support the visual editor these days? maybe its better to remove check for user-agent and for that small percentage of users to pay the extra cost of downloading a js file and not using it.

#6 @ChrisJDean
20 months ago

+1 on @mcfedr's issue!

UA is blank or not recognized since it's "Amazon CloudFront" and therefore experience is degraded for CMS users on desktop and mobile in various ways.

Would be great to have the check removed or the ability to add/define further allowed UA's somewhere/somehow.

Affected installs for us: WP 4.6.1

Last edited 20 months ago by ChrisJDean (previous) (diff)
Note: See TracTickets for help on using tickets.