--- gtk+-3.91.2/gtk/gtkbuilder-menus.c.orig	2017-10-25 01:01:04.000000000 +0200
+++ gtk+-3.91.2/gtk/gtkbuilder-menus.c	2017-11-07 21:00:56.000000000 +0100
@@ -103,11 +103,15 @@
       if (g_str_equal (element_name, "item"))
         {
           GMenuItem *item;
+          const gchar *id;
 
-          if (COLLECT (G_MARKUP_COLLECT_INVALID, NULL))
+          if (COLLECT (STRING | OPTIONAL, "id", &id))
             {
               item = g_menu_item_new (NULL, NULL);
               gtk_builder_menu_push_frame (state, NULL, item);
+
+              if (id != NULL)
+                _gtk_builder_add_object (state->parser_data->builder, id, G_OBJECT (item));
             }
 
           return;
