sybrew/the-seo-framework

Save button in FSE is always active for all pages and posts despite no changes were made

Closed this issue · 4 comments

Describe the bug
Save button in FSE is always active for all pages and posts despite no changes were made

How to reproduce the bug

  1. Put provided docker-compose.yml into some directory for testing clean Wordpress install:
services:
  db:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: somewordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
  wordpress:
    image: wordpress:6.6.1-php8.3-apache
    depends_on:
      - db
    ports:
      - 6050:80
    volumes:
      - ./wordpress:/var/www/html
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
      WORDPRESS_DB_NAME: wordpress
volumes:
  mysql:
  1. docker compose up
  2. Go to http://localhost:6050 and install Wordpress.
  3. Log into admin area via http://localhost:6050/wp-admin
  4. Go to Posts in the sidebar and edit Hello world post, notice that Save button is greyed out when you started to edit post
  5. Add The SEO Framework plugin
  6. Go to Posts in the sidebar and edit Hello world post, notice that Save button is active. Click Save, it is still active. It never gets greyed out.

Expected behavior

I expect Save button to be greyed out when no changes were made to the Post/Page since last save.

Screenshots

Not applicable.

Additional context

Wordpress: 6.6.1
The SEO Framework 5.0.6

Additional information:

Issue is gone if one comments out this line:

\add_action( 'add_meta_boxes', [ Admin\Settings\Post::class, 'prepare_meta_box' ] );

Thanks for the report! I still need to verify this, but it sounds like something TSF could do.

This appears to be a feature of Gutenberg / Block Editor.

When any meta box is shown (even the native Custom Fields one), the Save button will never be disabled.
This is likely because they cannot accurately determine if the meta box's contents have changed.

To bypass this, we'd have to integrate our meta fields into Gutenberg's sidebar rather than via a meta box. The realization of this is still ongoing.

Thank you @sybrew, relevant Gutenberg discussion:
WordPress/gutenberg#4184