Unable to set tabIndex on Button in CustomComponent when used in Table

We have implemented our own “ComboBox”, which is a CustomComponent with a Button and a TextField.
We set the tabIndex of the Button to -1, so that the user can tab directly from TextField to TextField.

When we use our “ComboBox” outside a Table, we get the expected tabIndex on the Button, but when we use it inside a Table, we get tabIndex 0.
If I set a tabIndex on the TextField it works as expected both outside and inside a Table.

Anyone have any idea what is going on here?

package com.example.test_customfield_tabindex;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.data.Container;
import com.vaadin.data.Property;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.AbstractLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.CustomField;
import com.vaadin.ui.Field;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Table;
import com.vaadin.ui.TableFieldFactory;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
@Theme("test_customfield_tabindex")
public class Test_customfield_tabindexUI extends UI {

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = Test_customfield_tabindexUI.class, widgetset = "com.example.test_customfield_tabindex.widgetset.Test_customfield_tabindexWidgetset")
    public static class Servlet extends VaadinServlet {
    }

    public static class Planet {
        
        String name;
        double distance;
        
        public Planet(String name, double distance) {
            super();
            this.name = name;
            this.distance = distance;
        }

        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public double getDistance() {
            return distance;
        }
        public void setDistance(double distance) {
            this.distance = distance;
        }
        
    }
    
    public static class MyCustomField extends CustomField<String> {

        TextField inputField = new TextField();
        
        @Override
        protected Component initContent() {
            AbstractLayout root = new HorizontalLayout();
            Button button = new Button();
            button.setIcon(FontAwesome.CARET_DOWN);
            button.setTabIndex(-1);
            root.addComponent(button);

            button.addClickListener(new Button.ClickListener() {
                public void buttonClick(ClickEvent event) {
                    Notification.show("Thank you for clicking");
                }
            });

            inputField.setTabIndex(1);
            root.addComponent(inputField);

            return root;
        }
        
        @Override
        public void setPropertyDataSource(Property newDataSource) {
            inputField.setPropertyDataSource(newDataSource);
        }

        @Override
        public Class<? extends String> getType() {
            return String.class;
        }
        
    }
    
    public static class MyFieldFactory implements TableFieldFactory {

        @Override
        public Field<?> createField(Container container, final Object itemId, final Object propertyId, Component uiContext) {
            return new MyCustomField();
        }

    }
    
    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
        
        layout.addComponent(new Label("CustomField outside table. Here button has tabIndex -1 :"));
        layout.addComponent(new MyCustomField());
        layout.addComponent(new CssLayout());
        layout.addComponent(new Label("CustomField inside table. Here button has tabIndex 0 :"));

        BeanItemContainer<Planet> container = new BeanItemContainer<>(Planet.class);
        container.addBean(new Planet("Mercury", 0.38709893));
        container.addBean(new Planet("Venus", 0.72333199));
        container.addBean(new Planet("Earth", 1.00000011));

        Table myTable = new Table();
        myTable.setContainerDataSource(container);
        myTable.setEditable(true);
        myTable.setTableFieldFactory(new MyFieldFactory());
        
        layout.addComponent(myTable);
        
    }

}