### Godot version

v4.2.dev3.official [013e8e3af]

### System information

Windows 10, 64bit

### Issue description

![image](https://github.com/godotengine/godot/assets/35988767/ccdac68c-a60d-491b-a406-d6e3bc1c95ae)
![GIF](https://github.com/godotengine/godot/assets/35988767/7d230faf-0260-4bc3-92e8-11cd026931a8)


### Steps to reproduce

/

### Minimal reproduction project

/
int menu_width = theme_cache.menu_icon->get_width();
	
	bool has_popup = popup_obj_id.is_valid();
	if (get_tab_count() == 0) {
		tab_bar->set_offset(SIDE_LEFT, 0);
		tab_bar->set_offset(SIDE_RIGHT, has_popup ? -menu_width : 0);
		return;
	}
	switch (get_tab_alignment()) {
		case TabBar::ALIGNMENT_LEFT: {
			tab_bar->set_offset(SIDE_LEFT, theme_cache.side_margin);
			tab_bar->set_offset(SIDE_RIGHT, has_popup ? -menu_width : 0);
		} break;
		case TabBar::ALIGNMENT_CENTER: {
			tab_bar->set_offset(SIDE_LEFT, 0);
			tab_bar->set_offset(SIDE_RIGHT, has_popup ? -menu_width : 0);
		} break;
		case TabBar::ALIGNMENT_RIGHT: {
			tab_bar->set_offset(SIDE_LEFT, 0);
			if (has_popup) {
				tab_bar->set_offset(SIDE_RIGHT, -menu_width);
				return;
			}
			int first_tab_pos = tab_bar->get_tab_rect(0).position.x;
			Rect2 last_tab_rect = tab_bar->get_tab_rect(get_tab_count() - 1);