Wysiwyg type fields cause an unsaved data Javascript alert
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, php, wordpress
- Área
- frontend
Línea de trabajo
Start by reproducing the issue on WordPress 5.6 with a CMB2 wysiwyg field, following the steps in the report; compare it with a textarea field. The report names no source files or tests, so trace the WYSIWYG field's JavaScript interaction with the post editor and its unsaved-change alert. Done means leaving the post after saving does not trigger an alert when there are no unsaved changes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Using a wysiwyg type field causes a JavaScript alert when leaving a post edit screen, even when there are no unsaved changes. This appears to be a new issue in WordPress 5.6, as far as I can tell. The issue does not happen if the type is textarea, only (as far as I can tell) when the type is wysiwyg.
I've been able to reproduce this on the develop branch, in a default WordPress install (version 5.6) with the twentytwentyone theme.
Steps to reproduce (I have confirmed I can reproduce this issue on the develop branch):
- Install CMB2
- Create a functions.php file with a single wysiwyg field
- Edit a new or existing post. Save it (if it's a draft) or publish it (if it's already published).
- Click any other link in the admin menu to leave this post.
Possible Solution
Possible Solution's Risk Level
This appears to be admin-only, but it is a big annoyance for admin users when they're editing a lot of posts in a given day, such as on a news website.
Screenshots
If applicable, add screenshots to help explain your problem.

CMB2 Field Registration Code:
/**
* Add custom fields to posts
*
*/
if ( ! function_exists( 'cmb2_post_fields' ) ) :
add_action( 'cmb2_init', 'cmb2_post_fields' );
function cmb2_post_fields() {
$object_type = 'post';
/**
* Excerpt settings
*/
$excerpt = new_cmb2_box(
array(
'id' => 'cmb2_excerpt',
'title' => __( 'Excerpt', 'twentytwentyone_child' ),
'object_types' => array( $object_type ), // Post type
'context' => 'after_editor',
'priority' => 'high',
'show_names' => false,
)
);
$excerpt->add_field(
array(
'id' => 'excerpt',
'name' => __( 'Excerpt', 'twentytwentyone_child' ),
'desc' => '',
'type' => 'wysiwyg',
'escape_cb' => false,
'options' => array(
'media_buttons' => false, // show insert/upload button(s)
'textarea_rows' => 5,
'teeny' => true, // output the minimal editor config used in Press This
),
)
);
}
endif;
Your Environment
Browser name and version: Firefox 83.0 and Chrome 87.0.4280.88
Operating System and version (desktop or mobile): macOS 10.15.7
Additional context
WordPress 5.6
- Lenguaje dominante
- PHP
- Estrellas
- 3k
- Forks
- 558
- Merge medio
- 12 h 26 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CMB2/CMB2
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
tomjn/coilbox-hub#755 ·
Los mantenedores suelen responder en 1 día
-
[Resource]: FlavianAbiertoresource-submission validation-passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
hesreallyhim/awesome-claude-code#3736 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100